{ "info": { "author": "Christian Theune, Stephan Richter and others", "author_email": "mail@gocept.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Zope3", "Intended Audience :: Developers", "License :: OSI Approved :: Zope Public License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP" ], "description": "======================\nUser self-registration\n======================\n\nThis package provides functionality to implement user self-registration for\napplications.\n\nThe general workflow requires that every user provides at least his email\naddress but additional data may be provided, too. After a user registered, an\nemail is send out asking him to confirm his identity by clicking a link that\nis embedded in the email. Once a registration is confirmed, the temporarily\nstored registration data is deleted.\n\nApplications can customize the registration behaviour by subscribing to events\nfor registration and confirmation and providing application-specific views and\nadapters for registration and email creation.\n\nThere is a demo application included in this package/buildout that shows how\nto use the basic views available to quickly create registration and\nconfirmation views and customized emails for your application. Both the views\nand the email generation provide a good degree of flexibility so they can be\nre-used directly, but you can also provide your own.\n\n\n======================\nUser self-registration\n======================\n\nRegistering a user\n==================\n\nRegistrations are managed by the registrations utility:\n\n >>> from gocept.registration.registrations import Registrations\n >>> registrations = Registrations()\n\nWe can now register a user by passing his email address and some additional\ndata:\n\n >>> peter = registrations.register('peter@example.com', {'name': u'Peter'})\n >>> peter\n \n\nAll registrations have a hash that anonymous identifies them, the email and\nthe data attached:\n\n >>> peter.hash\n ''\n >>> peter.email\n 'peter@example.com'\n >>> peter.data\n {'name': u'Peter'}\n\nPeter's registration is contained in the utility identified by the hash:\n\n >>> registrations[peter.hash]\n \n\nPeter can now confirm his registration using the hash that was given to him:\n\n >>> registrations.confirm(peter.hash)\n\nNow that he confirmed his registration, it isn't stored in the utility\nanymore:\n\n >>> registrations[peter.hash]\n Traceback (most recent call last):\n KeyError: ''\n\nCustomizing the Registration Object\n===================================\n\nWhen calling the ``register`` method, we can also optionally pass in a\nfactory to construct the registration. This is useful when\nsubclassing the ``Registration`` class.\n\n >>> from gocept.registration.registrations import Registration\n >>> class MyRegistration(Registration):\n ... def __init__(self, hash, email, data):\n ... assert data.has_key('agentNumber'), 'missing agent number!'\n ... super(MyRegistration, self).__init__(hash, email, data)\n\n >>> registrations.register('james@bond.com',\n ... {'name': u'James Bond'},\n ... factory=MyRegistration)\n Traceback (most recent call last):\n ...\n AssertionError: missing agent number!\n >>> registrations.register('james@bond.com',\n ... {'name': u'James Bond',\n ... 'agentNumber': u'007'},\n ... factory=MyRegistration)\n \n\n\nApplication hooks\n=================\n\nThere are two hooks that applications can tap into for customizing the registration process:\n\n- the ObjectAddedEvent for the registration object, and\n- the RegistrationConfirmedEvent when the user confirms his registration\n\nLet's register a subscriber for both events to demonstrate where each is called:\n\n >>> def registered(event):\n ... print event, event.object\n >>> import zope.component\n >>> from zope.app.container.interfaces import IObjectAddedEvent\n >>> zope.component.provideHandler(registered, (IObjectAddedEvent,))\n\n >>> chuck = registrations.register('chuck@example.com', {'name': u'LeChuck'})\n \n \n\n >>> def confirmed(event):\n ... print event, event.registration\n >>> from gocept.registration.interfaces import IRegistrationConfirmed\n >>> zope.component.provideHandler(confirmed, (IRegistrationConfirmed,))\n\n >>> registrations.confirm(chuck.hash)\n \n \n\nLet's clean those registrations up again:\n\n >>> from zope.app.testing import placelesssetup\n >>> placelesssetup.tearDown()\n\n\nConfirmation emails\n===================\n\nSending out registration emails is divided into two parts: creating the email\nitself, and sending it.\n\nCreating confirmation mails\n---------------------------\n\nTo provide some central configuration, registrations can be adapted to\nIRegistrationEmailConfiguration:\n\n >>> from gocept.registration.interfaces import IEmailConfiguration\n >>> from gocept.registration.interfaces import IRegistration\n >>> class TestConfig(object):\n ... zope.interface.implements(IEmailConfiguration)\n ... addr_from = \"Ad Ministrator \"\n ... confirmation_url = \"http://example.com/confirm?hash=%s\"\n ... confirmation_template = \"\"\"From: %(from)s\n ... To: %(to)s\n ... Subject: Please confirm your registration\n ... \n ... We received your registration. To activate it, please follow this confirmation\n ... \n ... link:\n ... \n ... %(link)s\"\"\"\n ... def __init__(self, registration):\n ... pass\n >>> zope.component.provideAdapter(TestConfig, adapts=(IRegistration,))\n\nThe confirmation email is created by adapting the registration object to the\nIRegistrationEmail interface. We provide a simple implementation to start\nfrom.\n\n >>> from gocept.registration.email import ConfirmationEmail\n >>> mail = ConfirmationEmail(chuck)\n >>> print mail.message\n From: Ad Ministrator \n To: chuck@example.com\n Subject: Please confirm your registration\n \n We received your registration. To activate it, please follow this confirmation\n link:\n \n http://example.com/confirm?hash=\n\n\nSending confirmation mails\n--------------------------\n\nWe provide a standard event handler that will send out an email for the\nregistration:\n\n >>> from gocept.registration.email import send_registration_mail\n >>> zope.component.provideAdapter(ConfirmationEmail, (IRegistration,))\n >>> zope.component.provideHandler(send_registration_mail, (IRegistration, IObjectAddedEvent,))\n >>> from zope.component.event import objectEventNotify\n >>> zope.component.provideHandler(objectEventNotify, (IObjectAddedEvent,))\n >>> from gocept.registration.tests import DummyMailer\n >>> zope.component.provideUtility(DummyMailer())\n >>> janine = registrations.register('janine@example.com')\n (Ad Ministrator -> ['janine@example.com'])\n From: Ad Ministrator \n To: janine@example.com\n Subject: Please confirm your registration\n \n We received your registration. To activate it, please follow this confirmation\n \n link:\n \n http://example.com/confirm?hash=\n\n\nChanges\n=======\n\n\n0.3.0 (2010-06-22)\n------------------\n\n- Feature: Allowing passing in a factory to the register of the\n ``Registrations`` object.\n- Bug: Fixed missing import statement for Contained.\n\n0.2.0 (2008-05-10)\n------------------\n\n- Feature: Made coverage report available for package.\n\n- Feature: Implement a testing registrations component that produces a\n predictable hash.\n\n- Feature: Use ``IMailDelivery`` interface instead of ``IMailer``.\n\n\n0.1.0 (2008-03-28)\n------------------\n\n- Initial release.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/pypi/gocept.registration/", "keywords": "zope3 gocept user registration", "license": "ZPL 2.1", "maintainer": null, "maintainer_email": null, "name": "gocept.registration", "package_url": "https://pypi.org/project/gocept.registration/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/gocept.registration/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://pypi.python.org/pypi/gocept.registration/" }, "release_url": "https://pypi.org/project/gocept.registration/0.3.0/", "requires_dist": null, "requires_python": null, "summary": "User self-registration", "version": "0.3.0" }, "last_serial": 1056122, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "60417ba25b1b307f8fff4612572585b8", "sha256": "dc8b034727faf043679f5fefec9732c9072168f24b13350c76439a003298dd3b" }, "downloads": -1, "filename": "gocept.registration-0.1.0.tar.gz", "has_sig": false, "md5_digest": "60417ba25b1b307f8fff4612572585b8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12004, "upload_time": "2008-03-28T17:11:31", "url": "https://files.pythonhosted.org/packages/7b/99/e2de639f3fa4c32ead2d7dcfacda75f5f42353c4fb53900940d692aa4fe7/gocept.registration-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "a246906c5e10e51479903581f294c7ab", "sha256": "2362379ad4eb71483974fbfc4dce9c9baa377ec79e40b8c8db6f452ff963032f" }, "downloads": -1, "filename": "gocept.registration-0.2.0.tar.gz", "has_sig": false, "md5_digest": "a246906c5e10e51479903581f294c7ab", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11450, "upload_time": "2008-05-11T04:28:24", "url": "https://files.pythonhosted.org/packages/18/4e/19fa96e057613d805b14dd59ae38fc8c7d09ca3ccb728dabb8367ee9adea/gocept.registration-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "f54585320f9eba88b6077fee7738d14c", "sha256": "9533254c7a08bd0d49750054149df6db543c0ff463f2ce844366d243361e4f3e" }, "downloads": -1, "filename": "gocept.registration-0.3.0.tar.gz", "has_sig": false, "md5_digest": "f54585320f9eba88b6077fee7738d14c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12600, "upload_time": "2010-06-22T15:11:07", "url": "https://files.pythonhosted.org/packages/18/2f/ffe50c68829b5f96080194d00f090d6ae242b25ebce7c2638d12009ea5a3/gocept.registration-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f54585320f9eba88b6077fee7738d14c", "sha256": "9533254c7a08bd0d49750054149df6db543c0ff463f2ce844366d243361e4f3e" }, "downloads": -1, "filename": "gocept.registration-0.3.0.tar.gz", "has_sig": false, "md5_digest": "f54585320f9eba88b6077fee7738d14c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12600, "upload_time": "2010-06-22T15:11:07", "url": "https://files.pythonhosted.org/packages/18/2f/ffe50c68829b5f96080194d00f090d6ae242b25ebce7c2638d12009ea5a3/gocept.registration-0.3.0.tar.gz" } ] }