Example #1
0
 def render_odf(self,
                field,
                key,
                value,
                REQUEST,
                render_format='ooo',
                render_prefix=None):
     """
   Render a Chart for ODT Style.
 """
     if REQUEST is None: REQUEST = get_request()
     form = field.aq_parent
     here = getattr(form, 'aq_parent', REQUEST)
     REQUEST.set('render_prefix', render_prefix)
     #needed to update REQUEST
     argument_dict = self.getArgumentDict(field, REQUEST)
     from xml.marshal.generic import dumps
     dump_args = dumps(argument_dict)
     #remove xml declaration (first processing node)
     dump_args = dump_args[dump_args.index('?>') + 2:]
     content = '''<office:include path="%s/ERP5Site_buildChart"
                              xlink:type="simple" xlink:actuate="onLoad"
                              xlink:show="embed">%s</office:include>
                              ''' % (here.getPath(), dump_args)
     return content
Example #2
0
 def send_ack(self, l):
     try:
         tmp = generic.dumps(l)
         client.getPage("http://%s:%d/rest/records/confirm/"%(self.server,self.port),
                        method='POST',
                        postdata=urllib.urlencode({"data" : tmp}),
                        headers={'Content-Type':'application/x-www-form-urlencoded'}
                        ).addCallback(self._send_confirm_done).addErrback(self._send_confirm_fail)
     except Exception, e:
         self._log.write("HTTP REC CONFIRM", e, "INFO")
Example #3
0
 def send_records(self, fold):
     tmp = generic.dumps(fold)
     self.pending_action_count += 1
     try:
         client.getPage("http://%s:%d/rest/records/deliver/"%(self.server,self.port),
                        method='POST',
                        postdata=urllib.urlencode({"data" : tmp}),
                        headers={'Content-Type':'application/x-www-form-urlencoded'}
                        ).addCallback(self._send_post_done).addErrback(self._send_post_fail)
     except Exception, e:
         self._log.write("HTTP REC DELIVER", e, "INFO")
Example #4
0
 def send_notify(self, msg, level):
     ErrLevel = {
         "INFO": 1,
         "WARN": 0,
         "ERR": -1,
         }
     results = {}
     results["level"] = ErrLevel[level]
     results["msg"] = msg
     try:
         tmp = generic.dumps(results)
         client.getPage("http://%s:%d/rest/notify/%d/"%(self.server,self.port, self.pid),
                        method='POST',
                        postdata=urllib.urlencode({"data" : tmp}),
                        headers={'Content-Type':'application/x-www-form-urlencoded'}
                        ).addCallback(self._notify_done).addErrback(self._notify_fail)
     except Exception, e:
         self._log.write("HTTP NOTIFY", e, "INFO")
Example #5
0
 def render_odf(self, field, key, value, REQUEST, render_format='ooo',
                render_prefix=None):
   """
     Render a Chart for ODT Style.
   """
   if REQUEST is None: REQUEST=get_request()
   form = field.aq_parent
   here = getattr(form, 'aq_parent', REQUEST)
   REQUEST.set('render_prefix', render_prefix)
   #needed to update REQUEST
   argument_dict = self.getArgumentDict(field, REQUEST)
   from xml.marshal.generic import dumps
   dump_args = dumps(argument_dict)
   #remove xml declaration (first processing node)
   dump_args = dump_args[dump_args.index('?>')+2:]
   content = '''<office:include path="%s/ERP5Site_buildChart"
                                xlink:type="simple" xlink:actuate="onLoad"
                                xlink:show="embed">%s</office:include>
                                ''' % (here.getPath(), dump_args)
   return content