Changeset 6286 for main/waeup.sirp/trunk/src
- Timestamp:
- 6 Jun 2011, 13:01:39 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/datacenter.py
r4996 r6286 36 36 super(DataCenter, self).__init__(*args, **kw) 37 37 self._createSubDirs() 38 38 39 39 def _setupLogger(self, logger): 40 40 """Setup datacenter logger. … … 51 51 '%(asctime)s - %(levelname)s - %(message)s') 52 52 handler.setFormatter(formatter) 53 53 54 54 # Here we decide, whether our messages will _also_ go to 55 55 # application log. … … 68 68 os.mkdir(path) 69 69 return 70 70 71 71 def getFiles(self, sort='name'): 72 72 """Get a list of files stored in `storage`. … … 101 101 LogFile(os.path.join(self.storage, 'logs', name))) 102 102 return result 103 103 104 104 def setStoragePath(self, path, move=False, overwrite=False): 105 105 """Set the path where to store files. … … 135 135 shutil.copystat(source, dest) 136 136 os.unlink(source) 137 137 138 138 def distProcessedFiles(self, successful, source_path, finished_file, 139 139 pending_file, mode='create', move_orig=True): … … 153 153 afterwards. Regular importers should put their stuff in 154 154 dedicated temporary dirs. 155 155 156 156 See datacenter.txt for more info about how this works. 157 157 """ … … 168 168 basename = maybe_basename 169 169 pending = True 170 170 171 171 base, ext = os.path.splitext(basename) 172 172 finished_name = "%s.%s.finished%s" % (base, mode, ext) … … 200 200 return 201 201 202 202 203 203 class DataCenterFile(object): 204 204 """A description of a file stored in data center. 205 205 """ 206 206 grok.implements(IDataCenterFile) 207 207 208 208 def __init__(self, context): 209 209 self.context = context … … 223 223 """ 224 224 return os.path.getctime(self.context) 225 225 226 226 def getSize(self): 227 227 """Get a human readable file size. … … 244 244 num += 1 245 245 return num 246 246 247 247 class LogFile(DataCenterFile): 248 248 """A description of a log file. … … 277 277 if marker in self._markers.keys(): 278 278 return self._markers[marker] 279 279 280 280 def getUserId(self): 281 281 return self._getMarker('user') or '<UNKNOWN>'
Note: See TracChangeset for help on using the changeset viewer.