Ignore:
Timestamp:
27 May 2009, 08:41:35 (15 years ago)
Author:
uli
Message:

Make CSV importer view working.

File:
1 edited

Legend:

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

    r4168 r4178  
    7777
    7878    def update(self, csvfile=None, clear=None, overwrite=None,
    79                CANCEL=None, SUBMIT=None):
     79               receiverid=None, CANCEL=None, SUBMIT=None):
    8080        if CANCEL is not None:
    8181            self.redirect(self.url(self.context))
     
    8383        if not csvfile:
    8484            return
    85         importer = IWAeUPXMLImporter(self.context)
    86         obj = importer.doImport(xmlfile)
    87         if type(obj) != type(self.context):
    88             return
    89         parent = self.context.__parent__
    90         name = self.context.__name__
    91         self.context = obj
    92         if hasattr(parent, name):
    93             setattr(parent, name, obj)
    94         else:
    95             del parent[name]
    96             parent[name] = obj
    97             pass
     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)
    9894        return
    9995
Note: See TracChangeset for help on using the changeset viewer.