Example #1
0
File: main.py Project: MrPetru/spam
    def post_activate(self, proj):
        """Activate a project"""
        query = query_projects_archived().filter_by(id=proj.decode("utf-8"))
        project = query.one()
        session = session_get()
        user = tmpl_context.user

        project.archived = False

        # invalidate cache
        project.touch()

        msg = "%s %s" % (_("Activated project:"), proj)

        # log into Journal
        journal.add(user, "%s %s" % (msg, project))

        # notify clients
        updates = [
            dict(item=project, type="added", topic=TOPIC_PROJECTS_ACTIVE),
            dict(item=project, type="deleted", topic=TOPIC_PROJECTS_ARCHIVED),
        ]
        notify.send(updates)

        return dict(msg=msg, status="ok", updates=updates)
Example #2
0
File: main.py Project: MrPetru/spam
    def get_all(self):
        """Return a `full` page for managing active and archived projects.

        This page is linked from the `admin` sidebar.
        """
        t_projects_active.value = query_projects().all()
        t_projects_archived.value = query_projects_archived().all()
        tmpl_context.t_projects_active = t_projects_active
        tmpl_context.t_projects_archived = t_projects_archived
        return dict(page="admin/project", sidebar=("admin", "projects"))
Example #3
0
File: main.py Project: MrPetru/spam
    def get_activate(self, proj, **kwargs):
        """Display a ACTIVATE confirmation form."""
        tmpl_context.form = f_confirm
        query = query_projects_archived().filter_by(id=proj.decode("utf-8"))
        project = query.one()

        f_confirm.custom_method = "ACTIVATE"
        f_confirm.value = dict(
            proj=project.id, id_=project.id, project_name_=project.name, description_=project.description
        )
        tmpl_context.form = f_confirm
        return dict(title="%s %s?" % (_("Are you sure you want to activate:"), project.name))