<s> """<STR_LIT>""" <EOL> from werkzeug import ( <EOL> unescape , redirect , Response , <EOL> ) <EOL> from kay . i18n import lazy_gettext as _ <EOL> from kay . cache import NoCacheMixin <EOL> from kay . cache . decorators import no_cache <EOL> from kay . handlers import BaseHandler <EOL> from kay . utils import ( <EOL> render_to_response , url_for <EOL> ) <EOL> from kay . conf import settings <EOL> from kay . registration . forms import RegistrationForm <EOL> from kay . registration . models import RegistrationProfile <EOL> class ActivateHandler ( BaseHandler , NoCacheMixin ) : <EOL> def __init__ ( self , template_name = '<STR_LIT>' , <EOL> extra_context = None ) : <EOL> self . template_name = template_name <EOL> self . extra_context = extra_context or { } <EOL> def get ( self , activation_key ) : <EOL> account = RegistrationProfile . activate_user ( activation_key ) <EOL> context = { '<STR_LIT>' : account , <EOL> '<STR_LIT>' : settings . ACCOUNT_ACTIVATION_DURATION } <EOL> for key , value in self . extra_context . items ( ) : <EOL> context [ key ] = callable ( value ) and value ( ) or value <EOL> return render_to_response ( self . template_name , context ) <EOL> class RegisterHandler ( BaseHandler , NoCacheMixin ) : <EOL> def __init__ ( self , next_url = None , form_cls = None , <EOL> template_name = '<STR_LIT>' , <EOL> extra_context = None ) : <EOL> self . next_url = next_url or url_for ( '<STR_LIT>' ) <EOL> self . form_cls = form_cls or RegistrationForm <EOL> self . template_name = template_name <EOL> self . extra_context = extra_context or { } <EOL> self . form = self . form_cls ( ) <EOL> def get ( self ) : <EOL> c = { '<STR_LIT>' : self . form . as_widget ( ) } <EOL> c . update ( self . extra_context ) <EOL> return render_to_response ( self . template_name , c ) <EOL> def post ( self ) : <EOL> if self . form . validate ( self . request . form ) : <EOL> self . form . save ( ) <EOL> return redirect ( self . next_url ) <EOL> else : <EOL> return self . get ( ) <EOL> @ no_cache <EOL> def registration_complete ( request ) : <EOL> return render_to_response ( '<STR_LIT>' ) </s>
