Changeset 12960


Ignore:
Timestamp:
17 May 2015, 20:02:59 (10 years ago)
Author:
Henrik Bettermann
Message:

Remove deprecated xml importer and exporter components.

Location:
main/waeup.kofa/trunk
Files:
5 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/CHANGES.txt

    r12958 r12960  
    441.3.2.dev0 (unreleased)
    55=======================
     6
     7* Remove deprecated xml importer and exporter components.
    68
    79* Rearrange datacenter upload page. Provide modal windows to view all
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py

    r12958 r12960  
    5555from waeup.kofa.interfaces import(
    5656    IKofaObject, IUsersContainer, IUserAccount, IDataCenter,
    57     IKofaXMLImporter, IKofaXMLExporter, IBatchProcessor,
     57    IBatchProcessor,
    5858    ILocalRolesAssignable, DuplicationError, IConfigurationContainer,
    5959    ISessionConfiguration, ISessionConfigurationAdd, IJobManager,
     
    17811781        return result
    17821782
    1783 class ExportXMLPage(grok.View):
    1784     """Deliver an XML representation of the context.
    1785     """
    1786     grok.name('export.xml')
    1787     grok.require('waeup.managePortal')
    1788 
    1789     def render(self):
    1790         exporter = IKofaXMLExporter(self.context)
    1791         xml = exporter.export().read()
    1792         self.response.setHeader(
    1793             'Content-Type', 'text/xml; charset=UTF-8')
    1794         return xml
    1795 
    1796 class ImportXMLPage(KofaPage):
    1797     """Replace the context object by an object created from an XML
    1798        representation.
    1799 
    1800        XXX: This does not work for ISite objects, i.e. for instance
    1801             for complete University objects.
    1802     """
    1803     grok.name('importxml')
    1804     grok.require('waeup.managePortal')
    1805 
    1806     def update(self, xmlfile=None, CANCEL=None, SUBMIT=None):
    1807         if CANCEL is not None:
    1808             self.redirect(self.url(self.context))
    1809             return
    1810         if not xmlfile:
    1811             return
    1812         importer = IKofaXMLImporter(self.context)
    1813         obj = importer.doImport(xmlfile)
    1814         if type(obj) != type(self.context):
    1815             return
    1816         parent = self.context.__parent__
    1817         name = self.context.__name__
    1818         self.context = obj
    1819         if hasattr(parent, name):
    1820             setattr(parent, name, obj)
    1821         else:
    1822             del parent[name]
    1823             parent[name] = obj
    1824             pass
    1825         return
    1826 
    1827 
    18281783#
    18291784# FacultiesContainer pages...
  • main/waeup.kofa/trunk/src/waeup/kofa/doctests/app.txt

    r12951 r12960  
    5757  <waeup.kofa.configuration.ConfigurationContainer object at 0x...>
    5858
    59 We can export universities. For this we lookup an appropriate exporter
    60 first::
    61 
    62   >>> from waeup.kofa.interfaces import IKofaExporter
    63   >>> exporter = IKofaExporter(myuniversity)
    64   >>> exporter
    65   <waeup.kofa.utils.importexport.Exporter object at 0x...>
    66 
    67 Now we can trigger the export::
    68 
    69   >>> exporter.export()
    70   <cStringIO.StringO object at 0x...>
    71 
    72 We can also get an XML representation as file. If we do not provide a
    73 filepath, we will get an instance of `cStringIO.StringIO`, i.e. a
    74 memory file::
    75 
    76   >>> from waeup.kofa.interfaces import IKofaXMLExporter
    77   >>> exporter = IKofaXMLExporter(myuniversity)
    78   >>> f = exporter.export()
    79   >>> f
    80   <cStringIO.StringO object at 0x...>
    81 
    82   >>> print f.read()
    83   <?xml version="1.0" encoding="utf-8" ?>
    84   <pickle>
    85     <initialized_object id="...">
    86   ...
    87   </pickle>
    88 
    8959Kofa plugins
    9060============
  • main/waeup.kofa/trunk/src/waeup/kofa/doctests/pages.txt

    r12938 r12960  
    150150
    151151  >>> browser.open('http://localhost/myuniversity//@@change_language?lang=en')
    152 
    153 We can export a university as XML::
    154 
    155   >>> browser.open('http://localhost/myuniversity/export.xml')
    156   >>> print browser.contents
    157   <?xml version="1.0" encoding="utf-8" ?>
    158   <pickle>
    159   ...
    160   </pickle>
    161 
    162   >>> print browser.headers
    163   Status: 200 Ok
    164   Content-Length: ...
    165   Content-Type: text/xml; charset=UTF-8
    166   X-Powered-By: Zope (www.zope.org), Python (www.python.org)
    167152
    168153
Note: See TracChangeset for help on using the changeset viewer.