Esempio n. 1
0
class SignUpPage(Document):

    members_order = [
        "user_type", "roles", "confirmation_target",
        "confirmation_email_template"
    ]

    # Defines the persistent class that will be
    # used like schema in signup process
    user_type = schema.Reference(class_family=User,
                                 required=True,
                                 member_group="signup_process")

    # The collection of roles that will be applyed
    # to each instance (of user_type class) created throw
    # a signuppage
    roles = schema.Collection(
        items="woost.models.Role",
        related_end=schema.Collection(name="related_signup_pages",
                                      visible=False),
        member_group="signup_process",
        relation_constraints=lambda ctx: [excluded_roles()])

    # If is None, doesn't require an email confirmation
    # process to complete signup process
    confirmation_email_template = schema.Reference(
        type=EmailTemplate,
        related_end=schema.Collection(),
        member_group="signup_process")

    confirmation_target = schema.Reference(type="woost.models.Publishable",
                                           related_end=schema.Collection(),
                                           member_group="signup_process",
                                           required=True)

    default_template = schema.DynamicDefault(lambda: Template.get_instance(
        qname=u"woost.extensions.signup.signup_template"))

    default_controller = schema.DynamicDefault(lambda: Controller.get_instance(
        qname=u"woost.extensions.signup.signup_controller"))

    default_confirmation_email_template = schema.DynamicDefault(
        lambda: EmailTemplate.get_instance(
            qname=u"woost.extensions.signup.signup_confirmation_email_template"
        ))

    default_confirmation_target = schema.DynamicDefault(
        lambda: Publishable.get_instance(
            qname=u"woost.extensions.signup.signup_confirmation_target"))
Esempio n. 2
0
 def resolve_path(self, path):
     if path:
         try:
             id = int(path[0])
         except:
             pass
         else:
             publishable = Publishable.get_instance(id)
             if publishable is not None:
                 return PathResolution(
                     self,
                     publishable,
                     [path[0]],
                     path[1:]
                 )
Esempio n. 3
0
 def resolve_path(self, path):
     
     remaining_path = list(path)
     extra_path = []
     
     while remaining_path:
         page = Publishable.get_instance(
             full_path = u"/".join(remaining_path)
         )
         if page:
             return PathResolution(
                 self,
                 page,
                 remaining_path,
                 extra_path
             )
         extra_path.append(remaining_path.pop())
Esempio n. 4
0
def set_exportable_flag():

    for item in [Configuration.instance] + list(Website.select()):
        for key in ("login_page", "maintenance_page", "generic_error_page",
                    "not_found_error_page", "forbidden_error_page"):
            page = getattr(item, key, None)
            if page:
                page.x_staticpub_exportable = False

        for qname in ("woost.password_change_page",
                      "woost.password_change_confirmation_page"):
            page = Publishable.get_instance(qname=qname)
            if page:
                page.included_in_static_publication = False

    for cls in get_publishable_models():
        member = cls.get_member("x_staticpub_exportable")
        if member and member.indexed:
            member.rebuild_index()