Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes
Marshall.export.Export Class Reference
Inheritance diagram for Marshall.export.Export:
Inheritance graph
[legend]
Collaboration diagram for Marshall.export.Export:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def marshall_data
def marshall_metadata
def marshall
def export
def export_info

Static Public Attributes

tuple security = ClassSecurityInfo()
tuple atxml_template

Detailed Description

Definition at line 35 of file export.py.


Member Function Documentation

def Marshall.export.Export.export (   self,
  context,
  paths 
)

Definition at line 78 of file export.py.

00078 
00079     def export(self, context, paths):
00080         data = StringIO()
00081         out = zipfile.ZipFile(data, 'w')
00082 
00083         for path in paths:
00084             filename = os.path.basename(path)
00085             dir_path = os.path.dirname(path)
00086             obj = context.restrictedTraverse(path)
00087 
00088             # Write data
00089             fpath = os.path.join(dir_path, filename)
00090             stream = self.marshall_data(obj)
00091             out.writestr(fpath, stream.read())
00092 
00093             # Write metadata
00094             metadata_path = os.path.join(dir_path, '.metadata')
00095             fpath = os.path.join(metadata_path, filename)
00096             stream = self.marshall_metadata(obj)
00097             out.writestr(fpath, stream.read())
00098         out.close()
00099         data.seek(0)
00100         return data

Here is the call graph for this function:

def Marshall.export.Export.export_info (   self,
  context,
  info 
)

Definition at line 102 of file export.py.

00102 
00103     def export_info(self, context, info):
00104         data = StringIO()
00105         out = zipfile.ZipFile(data, 'w')
00106 
00107         for d in info:
00108             path = d.get('path', d.get('id'))
00109             filename = os.path.basename(path)
00110             dir_path = os.path.dirname(path)
00111 
00112             # Write data
00113             _d = d.get('data', '')
00114             fpath = os.path.join(dir_path, filename)
00115             out.writestr(fpath, _d)
00116 
00117             metadata = d.copy()
00118             for name in ('data', 'path'):
00119                 if metadata.has_key(name):
00120                     del metadata[name]
00121             # Write metadata
00122             metadata_path = os.path.join(dir_path, '.metadata')
00123             fpath = os.path.join(metadata_path, filename)
00124             _d = str(self.atxml_template(info=metadata))
00125             out.writestr(fpath, _d)
00126 
00127         out.close()
00128         data.seek(0)
00129         return data
00130 
00131 InitializeClass(Export)
def Marshall.export.Export.marshall (   self,
  obj,
  marshaller 
)

Definition at line 57 of file export.py.

00057 
00058     def marshall(self, obj, marshaller):
00059         REQUEST = obj.REQUEST
00060         RESPONSE = REQUEST.RESPONSE
00061         ddata = marshaller.marshall(obj, REQUEST=REQUEST,
00062                                     RESPONSE=RESPONSE)
00063         if hasattr(aq_base(obj), 'marshall_hook') \
00064            and obj.marshall_hook:
00065             ddata = obj.marshall_hook(ddata)
00066 
00067         content_type, length, data = ddata
00068 
00069         if type(data) is type(''): return StringIO(data)
00070 
00071         s = StringIO()
00072         while data is not None:
00073             s.write(data.data)
00074             data=data.next
00075         s.seek(0)
00076         return s

Here is the caller graph for this function:

def Marshall.export.Export.marshall_data (   self,
  obj 
)

Definition at line 45 of file export.py.

00045 
00046     def marshall_data(self, obj):
00047         from Products.Marshall.registry import getComponent
00048         marshaller = getComponent('primary_field')
00049         return self.marshall(obj, marshaller)

Here is the call graph for this function:

Here is the caller graph for this function:

def Marshall.export.Export.marshall_metadata (   self,
  obj 
)

Definition at line 51 of file export.py.

00051 
00052     def marshall_metadata(self, obj):
00053         from Products.Marshall.registry import getComponent
00054         marshaller = getComponent('atxml')
00055         return self.marshall(obj, marshaller)

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Initial value:
PageTemplateFile(
        'www/atxml', globals(),
        __name__ = 'atxml_template')

Definition at line 40 of file export.py.

tuple Marshall.export.Export.security = ClassSecurityInfo() [static]

Definition at line 37 of file export.py.


The documentation for this class was generated from the following file: