Changeset 6542 for main/waeup.sirp


Ignore:
Timestamp:
23 Jul 2011, 10:22:10 (13 years ago)
Author:
uli
Message:

Fix _getStoragePath to create not-existing subdirs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/accesscodes.py

    r6499 r6542  
    269269    def _getStoragePath(self):
    270270        """Get the directory, where batch import files are stored.
     271
     272        If the path does not exist yet, it is created. The path is
     273        normally ``accesscodes/imports`` below the datacenter storage
     274        path (see :data:`waeup.sirp.accesscodes.Datacenter.storage`).
    271275        """
    272276        site = grok.getSite()
     
    274278        ac_storage = os.path.join(storagepath, 'accesscodes')
    275279        import_path = os.path.join(ac_storage, 'imports')
    276         if not os.path.exists(import_path):
    277             os.mkdir(import_path)
     280        for path in [ac_storage, import_path]:
     281            if not os.path.exists(path):
     282                os.mkdir(path)
     283                site.logger.info('created path %s' % path)
    278284        return import_path
    279285
    280286    def addBatch(self, batch):
    281         """Add a batch.
     287        """Add an already created `batch`.
    282288        """
    283289        batch.num = self.getNum(batch.prefix)
Note: See TracChangeset for help on using the changeset viewer.