Ejemplo n.º 1
0
def handle_postcreation(event):
    project = event.project
    request = project.REQUEST

    # add the featurelets, if any
    request.set('__initialize_project__', None)

    # Fetch the values from request and store them.
    project.processForm(metadata=1)

    # We don't need this here. do we? DWM
    _initialize_project(project, event.request)

    # add defaulting redirect hooks(may be overwritten by other
    # events)
    redirect.activate(project)
    
    # ugh... roster might have been created by an event before a
    # team was associated (in _initializeProject), need to fix up
    roster_id = project.objectIds(spec='OpenRoster')
    if roster_id:
        roster = project._getOb(roster_id[0])
        if not roster.getTeams():
            roster.setTeams(project.getTeams())

    # we need to remove the Owner role which is assigned to the
    # member who created the project; otherwise the creator will
    # have all administrative privileges even after he leaves
    # the project or is demoted to member.
    owners = project.users_with_local_role("Owner")
    project.manage_delLocalRoles(owners)

    teams = project.getTeams()
    for team in teams:
        team.reindexTeamSpaceSecurity()
Ejemplo n.º 2
0
def _handle_parent_child_association(parent, child):
    child_id = child.getId()
    parent_info = redirect.get_info(parent)
    child_path = redirect.pathstr(child)
    parent_path = redirect.pathstr(parent)
    parent_info[child_id] = child_path

    child_url = parent_info.url
    if not child_url.endswith('/'):
        child_url += '/'
    child_url += child_id

    child_info = redirect.activate(child, url=child_url)
    child_info.parent = parent_path
Ejemplo n.º 3
0
 def fset(self, val):
     if val:
         return redirect.activate(self.context, self.redirect_url)
     return redirect.deactivate(self.context)
Ejemplo n.º 4
0
def add_redirection_hooks(container, ignore=[]):
    for obj in container.objectValues():
        if IProject.providedBy(obj) and obj.getId() not in ignore:
            redirect.activate(obj)