Changeset 4181 for waeup/branches


Ignore:
Timestamp:
27 May 2009, 08:48:19 (16 years ago)
Author:
uli
Message:

Move ImportCSV view to datacenter.

Location:
waeup/branches/ulif-rewrite/src/waeup
Files:
2 edited

Legend:

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

    r4177 r4181  
    1313from zope.interface import Interface
    1414from waeup.interfaces import IWAeUPObject, IWAeUPCSVImporter, ICSVDataReceivers
    15 from waeup.viewlets import Index, ImportCSV, MainArea, LeftSidebar
     15from waeup.viewlets import Index, MainArea, LeftSidebar
     16#from waeup.viewlets import ImportCSV
    1617
    1718class DataCenter(grok.Container):
     
    252253        return u'<div class="portlet"><a href="@@settings">Settings</a></div>'
    253254
     255class ImportCSV(grok.View):
     256    """A view for importing things.
     257
     258    """
     259    grok.require('waeup.manageUniversity')
     260    grok.template('master')
     261
     262    def update(self, csvfile=None, clear=None, overwrite=None,
     263               receiverid=None, CANCEL=None, SUBMIT=None):
     264        if CANCEL is not None:
     265            self.redirect(self.url(self.context))
     266            return
     267        if not csvfile:
     268            return
     269        if not SUBMIT:
     270            return
     271        receivers = self.context.getReceiverIds()
     272        if receiverid not in receivers.keys():
     273            return
     274        receiver = receivers[receiverid]
     275        from waeup.interfaces import IWAeUPCSVImporter
     276        importer = IWAeUPCSVImporter(receiver)
     277        importer.doImport(csvfile)
     278        return
     279
    254280class Import(object):
    255281    def __init__(self, filedescr, importers):
  • waeup/branches/ulif-rewrite/src/waeup/viewlets.py

    r4178 r4181  
    6969        return
    7070       
    71 class ImportCSV(grok.View):
    72     """A view for importing things.
    73 
    74     """
    75     grok.require('waeup.manageUniversity')
    76     grok.template('master')
    77 
    78     def update(self, csvfile=None, clear=None, overwrite=None,
    79                receiverid=None, CANCEL=None, SUBMIT=None):
    80         if CANCEL is not None:
    81             self.redirect(self.url(self.context))
    82             return
    83         if not csvfile:
    84             return
    85         if not SUBMIT:
    86             return
    87         receivers = self.context.getReceiverIds()
    88         if receiverid not in receivers.keys():
    89             return
    90         receiver = receivers[receiverid]
    91         from waeup.interfaces import IWAeUPCSVImporter
    92         importer = IWAeUPCSVImporter(receiver)
    93         importer.doImport(csvfile)
    94         return
    95 
    9671class Head(grok.ViewletManager):
    9772    """additions to HTML head"""
Note: See TracChangeset for help on using the changeset viewer.