Ignore:
Timestamp:
27 Jun 2010, 09:43:39 (14 years ago)
Author:
uli
Message:

Update methods to store importer_username on imports.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/branches/ulif-fasttables/src/waeup/sirp/jambtables/jambtables.py

    r5248 r5254  
    7070    grok.implements(IJAMBDataTable)
    7171
     72    #: The datetime when data was imported.
    7273    import_datetime = None
     74
     75    #: The username of the person that initiated the last import.
     76    importer_username = None
    7377   
    7478    def __init__(self):
     
    107111    def clear(self):
    108112        """Remove all existing entries.
     113
     114        Unsets also the :attr:`import_datetime` and
     115        :attr:`importer_username` attributes.
    109116        """
    110117        self.import_datetime = None
     118        self.importer_username = None
    111119        if self._datafile_path is None:
    112120            return
     
    117125        self._datafile_path = None
    118126           
    119     def importFromCSV(self, filepath):
     127    def importFromCSV(self, filepath, username=None):
    120128        """Importing data from a CSV file means to copy the source to a safe
    121129           location.
     130
     131           If the username is set, it will be stored as well in
     132           :attr:`importer_username`.
    122133        """
    123134        self.clear()
    124135        self.import_datetime = datetime.now()
     136        self.importer_username = None
     137        if username is not None:
     138            self.importer_username = unicode(username)
    125139        self._copyDataFile(filepath)
    126140
Note: See TracChangeset for help on using the changeset viewer.