Package: tgapp-registration
About TGApp-RegistrationRegistration is a Pluggable registration application for TurboGears2.
By default it will work with the quickstart TurboGears User model
but provides a bunch of hooks that can be used to change the registration
form and most of the registration aspects.Registration currently supports bothSQLAlchemyandMongoDBfor database storage.Registration supports bothTurbomailandtgext.mailerto send emails.Installingtgapp-registration can be installed both from pypi or from bitbucket:pip install tgapp-registrationshould just work for most of the usersIf you want to useTurbomailas sender install it from pypi:pip install turbomailIf you want to usetgext.maileras sender install it from pypi or from bitbucket:pip install tgext.mailerPlugging RegistrationIn your applicationconfig/app_cfg.pyimportplug:from tgext.pluggable import plugThen at theend of the filecall plug with registration:plug(base_config, 'registration')If you usetgext.maileryou need to plug it:plug(base_config, 'tgext.mailer')You will be able to access the registration process athttp://localhost:8080/registration.Some options are available that can be set on.iniconfiguration file for your application.
At least one option is required to make activation emails
work:registration.email_sender-> Outgoing mails sender address (likeno-repy@domain.com)If you are usingtgext.maileryou need to set up some configuration, check here for available options:https://github.com/amol-/tgext.mailer.If you are not using neitherTurboMailortgext.mailera few more configuration
options must be set to make activation email work:registration.smtp_host-> SMTP server to use to send emailsregistration.smtp_login-> Login for authentication on SMTP serverregistration.smtp_passwd-> Password for authentication on SMTP serverPlugin OptionsWhen pluggingtgapp-registrationthe following options
can be passed to the plug call:registration.form-> Full python path of the form class to use for Registration form. By defaultregistration.lib.forms.RegistrationFormis used.Available HooksRegistration exposes some hooks to configure it’s behavior,
The hooks that can be used with TurboGears2register_hookare:registration.before_registration_form(arguments)-> Runs before rendering the form. Can be used to insert preconditions to limit the registration for example just to invited users. You can fill the form inserting data into arguments, you might want to put a json serialized dictionary into arguments[‘extra’] that is an HiddenField in the formregistration.before_registration(submitted_values)-> Runs after form submission. Can be used to change the values submitted by the form before they are usedregistration.after_registration(registration, submitted_values)-> Runs after form submission. Can be used to store eventual data that the form sent and that the Registration model doesn’t support.registration.on_complete(registration, email_data)-> Runs after registration completion before sending activation email, can be used to change outgoing email.registration.before_activation(registration, user)-> Runs at activation before creating the user and setting the registration as activeregistration.after_activation(registration, user)-> Runs after creating user, can be used to callredirectto redirect to a different page at registration completion.Exposed TemplatesThe templates used by registration and that can be replaced withtgext.pluggable.replace_templateare:registration.templates.registerregistration.templates.completeAlembic Migrationstgapp-registration version0.9.6included theextrasfield in sqlalchemy model.
to upgrade from earlier versions you need to run:gearbox migrate-pluggable -c your_config.ini registration upgrade