Exemple #1
0
 def exportXmlData(self):
     """
     export data as XML to the web browser
     """
     from zope.xmlpickle import toxml
     import pickle
     obj = self.context
     pickleAdapter = IPickle(obj)
     if pickleAdapter:
         self.request.response.setHeader('Content-Type',
                                         'application/ict-xml')
         filename = datetime.now().strftime('ictxml_%Y%m%d%H%M%S.xml')
         self.request.response.setHeader(
             'Content-Disposition',
             'attachment; filename=\"%s\"' % filename)
         setNoCacheHeaders(self.request.response)
         pickleDump = pickle.dumps(pickleAdapter.exportAsDict())
         #return xmlEscapeWithCData(
         ##u'<?xml version="1.0" encoding="ISO-8859-1"?>'
         ##u'<datadump>%s</datadump>',
         #toxml(pickleDump))
         #return pprint.pformat(pickleAdapter.exportAsDict(), \
         #width=60, depth=6)
         return toxml(pickleDump)
     else:
         return _(u"no pickle adapter")
Exemple #2
0
 def sendPerMq(self, send_data=None):
     """
     will send command via Message Queue to an other System
     """
     supervisor = queryUtility(IAdmUtilSupervisor)
     mq_utility = getUtility(IMailDelivery, 'ikObjTransportQueue')
     if (supervisor and mq_utility and send_data):
         from_adr = u"http://%s@%s:8080%s" % \
                  (send_data['header']['from_oid'], \
                   send_data['header']['from_ip'], \
                   send_data['header']['from_path'])
         to_adr = u"http://%s@%s:8080%s" % \
                  (send_data['header']['to_oid'], \
                   send_data['header']['to_ip'], \
                   send_data['header']['to_path'])
         python_pickle = pickle.dumps(send_data)
         mq_utility.send(from_adr, [to_adr], toxml(python_pickle))
Exemple #3
0
    def exportXmlData(self):
        """get data file for all objects"""
        #dataStructure = {
        #'objects': ['a', 'b', 'c'],
        #'conns': [1, 2, 3],
        #}
        dataStructure = {
            'objects': [],
        }
        its = self.items()
        for (dummy_name, oobj) in its:
            if ISuperclass.providedBy(oobj):
                dataStructure['objects'].append(oobj.ikName)
#        sitemanger = zapi.getParent(self)
#        locSitemanager = zapi.getParent(sitemanger)
#        root_folder = zapi.getParent(locSitemanager)
#        for folder in root_folder.values():
#            for obj in folder.values():
#                obj.getAllExportData(dataStructure)
        python_pickle = pickle.dumps(dataStructure)
        return toxml(python_pickle)
Exemple #4
0
 def exportAllData(self):
     """get data file for all objects"""
     #dataStructure = {
         #'objects': ['a', 'b', 'c'],
         #'conns': [1, 2, 3],
         #}
     dataStructure = {
         'objects': [],
         'conns': [],
         }
     sitemanger = zapi.getParent(self)
     locSitemanager = zapi.getParent(sitemanger)
     root_folder = zapi.getParent(locSitemanager)
     for folder in root_folder.values():
         for obj in folder.values():
             obj.getAllExportData(dataStructure)
     print "*" * 80
     from pprint import pprint
     pprint(dataStructure)
     print "*" * 80
     python_pickle = pickle.dumps(dataStructure)
     return toxml(python_pickle)
Exemple #5
0
 def convert2string(self, obj):
     """
     converts an object to an string
     """
     python_pickle = dumps(obj)
     return toxml(python_pickle)