Ejemplo n.º 1
0
 def render(self):
     sdata = {'data': []}
     for i in self.items:
         sdata['data'].append(data_from_ctx(i.getObject()))
     resp = self.events(**sdata).encode('utf-8')
     self.request.response.setHeader('Content-Type','text/xml')
     self.request.response.addHeader(
         "Content-Disposition","filename=%s.xml" % (
             self.context.getId()))
     self.request.response.setHeader('Content-Length', len(resp))
     self.request.response.write(resp)
Ejemplo n.º 2
0
 def render(self):
     sdata = {'events': []}
     for i in self.items:
         sdata['events'].append(data_from_ctx(i.getObject()))
     resp = json.dumps(sdata)
     self.request.response.setHeader('Content-Type','application/json')
     self.request.response.addHeader(
         "Content-Disposition","filename=%s.json" % (
             self.context.getId()))
     self.request.response.setHeader('Content-Length', len(resp))
     self.request.response.write(resp)
Ejemplo n.º 3
0
 def render(self):
     rows = []
     for ix in self.items:
         sdata = data_from_ctx(ix.getObject())
         for it in ['targets', 'subjects',
                    'related', 'contained']:
             values = []
             for item in sdata[it]:
                 val = item
                 if it in ['targets', 'subjects']:
                     if not val.strip():
                         # skip empty keywords
                         continue
                 if it in ['related', 'contained']:
                     val = '%s%s%s' % (
                         val['sid'], lei.SID_EID_SPLIT,
                         val['eid'])
                 values.append(val)
             sdata[it] = '|'.join(values)
         rows.append(sdata)
     if rows:
         titles = rows[0].keys()
         titles.sort()
         export_csv(self.request, titles, rows)