cc-4105: added comments. fixed some docstring formatting

This commit is contained in:
Rudi Grinberg 2012-08-02 10:48:46 -04:00
parent c8df791d13
commit 01c44e32d1
2 changed files with 7 additions and 2 deletions

View File

@ -18,8 +18,10 @@ class Organizer(ReportHandler,Loggable):
self.target_path = target_path
super(Organizer, self).__init__(signal=self.channel)
def handle(self, sender, event):
"""Intercept events where a new file has been added to the organize
directory and place it in the correct path (starting with self.target_path)"""
"""
Intercept events where a new file has been added to the organize
directory and place it in the correct path (starting with self.target_path)
"""
try:
new_path = mmp.organized_path(event.path, self.target_path, event.metadata.extract())
mmp.magic_move(event.path, new_path)

View File

@ -305,11 +305,13 @@ def last_modified(path):
else: 0
def import_organize(store):
# TODO : get rid of this later
"""returns a tuple of organize and imported directory from an airtime store directory"""
store = os.path.normpath(store)
return os.path.join(store,'organize'), os.path.join(store,'imported')
def expand_storage(store):
# TODO : document
store = os.path.normpath(store)
return {
'organize' : os.path.join(store, 'organize'),
@ -330,6 +332,7 @@ def create_dir(path):
if not os.path.exists: raise FailedToCreateDir(path)
def sub_path(directory,f):
# TODO : document
normalized = normpath(directory)
common = os.path.commonprefix([ directory, normpath(f) ])
return common == normalized