Ignore:
Timestamp:
2 Apr 2009, 12:56:08 (16 years ago)
Author:
uli
Message:

Add a view for XML exports.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-rewrite/src/waeup/viewlets.py

    r3895 r4053  
    33import zope.interface
    44from zope.component import getMultiAdapter
    5 from interfaces import IUniversity, IWAeUPObject
     5from interfaces import IUniversity, IWAeUPObject, IWAeUPXMLExporter
    66
    77grok.context(zope.interface.Interface)
     
    2323    grok.template('master')
    2424
     25class ExportXML(grok.View):
     26    """Deliver an XML representation of the context.
     27    """
     28    grok.name('export.xml')
     29    grok.require('waeup.manageUniversity')
     30   
     31    def render(self):
     32        exporter = IWAeUPXMLExporter(self.context)
     33        xml = exporter.export().read()
     34        self.response.setHeader(
     35            'Content-Type', 'text/xml; charset=UTF-8')
     36        return xml
     37   
    2538class Head(grok.ViewletManager):
    2639    """additions to HTML head"""
Note: See TracChangeset for help on using the changeset viewer.