Пример #1
0
    def handle_publish(self, action, data):
        self.generated_content = self.generateContent(data)
        if IWorkspaceScheduling.providedBy(self.request):
            if not hasattr(self.context, "group_id"):
                context_group_id = ISchedulingContext(self.context).group_id
            else:
                context_group_id = self.context.group_id
        else:
            #get the chamber id
            context_group_id = get_chamber_for_context(
                self.context).parliament_id
        report = domain.Report(
            title=self.title,
            start_date=self.start_date,
            end_date=self.end_date,
            body=self.generated_content,
            owner_id=get_login_user().user_id,  # !+GROUP_AS_OWNER
            language=self.language,
            group_id=context_group_id)
        session = Session()
        session.add(report)
        session.flush()
        notify(ObjectCreatedEvent(report))
        self.status = _(u"Report has been processed and saved")

        return self.template()
Пример #2
0
 def handle_publish(self, action, data):
     self.generated_content = self.generate_content(data)
     if IWorkspaceScheduling.providedBy(self.request):
         if not hasattr(self.context, "group_id"):
             context_group_id = ISchedulingContext(self.context).group_id
         else:
             context_group_id = self.context.group_id
     else:
         # get the chamber id
         context_group_id = get_chamber_for_context(self.context).group_id
     report = domain.Report(
         title=self.title,
         start_date=self.start_date,
         end_date=self.end_date,
         body=self.generated_content,
         owner_id=get_login_user().user_id, # !+GROUP_AS_OWNER
         language=self.language,
         group_id=context_group_id
     )
     session = Session()
     session.add(report)
     session.flush()
     # requires self db id to have been updated
     report.on_create() 
     notify(ObjectCreatedEvent(report))
     self.status = _(u"Report has been processed and saved")
     return self.template()
Пример #3
0
 def buildContext(self):
     if IWorkspaceScheduling.providedBy(self.request):
         self.buildSittings()
     elif IWorkspaceUnderConsideration.providedBy(self.context):
         default_filters = {
             'sort_dir':
             u'asc',
             'filter_status_date':
             u'%s->%s' %
             (self.start_date.isoformat(), self.end_date.isoformat()),
             'sort_on':
             u'status_date',
             'filter_type':
             u'',
         }
         doc_container = self.context.publishTraverse(
             self.request, "documents")
         for type_key, ti in capi.iter_type_info():
             workflow = ti.workflow
             if workflow and workflow.has_feature("workspace"):
                 #add generators of various doctypes
                 container_name = naming.plural(type_key)
                 filters = dict(default_filters)
                 filters['filter_type'] = type_key
                 setattr(self, container_name,
                         doc_container.query(**filters)[0])
Пример #4
0
 def buildContext(self):
     if IWorkspaceScheduling.providedBy(self.request):
         self.buildSittings()
     elif IWorkspaceUnderConsideration.providedBy(self.context):
         default_filters = {
             'sort_dir': u'asc', 
             'filter_status_date': u'%s->%s' %(
                 self.start_date.isoformat(), self.end_date.isoformat()
             ), 
             'sort_on': u'status_date', 
             'filter_type': u'',
         }
         doc_container = self.context.publishTraverse(self.request,
             "documents")
         for type_key, ti in capi.iter_type_info():
             workflow = ti.workflow
             if workflow and workflow.has_feature("workspace"):
                 #add generators of various doctypes
                 container_name = naming.plural(type_key)
                 filters = dict(default_filters)
                 filters['filter_type'] = type_key
                 setattr(self, container_name,
                     doc_container.query(**filters)[0]
                 )