formatted docstrings. fixed decorator with functools
This commit is contained in:
parent
2e54fd64d3
commit
10a6a4d541
|
@ -1,6 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import pyinotify
|
||||
from pydispatch import dispatcher
|
||||
from functools import wraps
|
||||
|
||||
import media.monitor.pure as mmp
|
||||
from media.monitor.pure import IncludeOnly
|
||||
|
@ -31,6 +32,7 @@ class FileMediator(object):
|
|||
def unignore(path): FileMediator.ignored_set.remove(path)
|
||||
|
||||
def mediate_ignored(fn):
|
||||
@wraps(fn)
|
||||
def wrapped(self, event, *args,**kwargs):
|
||||
event.pathname = unicode(event.pathname, "utf-8")
|
||||
if FileMediator.is_ignored(event.pathname):
|
||||
|
|
|
@ -10,14 +10,12 @@ from os.path import dirname
|
|||
import os.path
|
||||
|
||||
class Organizer(ReportHandler,Loggable):
|
||||
"""
|
||||
Organizer is responsible to to listening to OrganizeListener events
|
||||
and committing the appropriate changes to the filesystem. It does
|
||||
not in any interact with WatchSyncer's even when the the WatchSyncer
|
||||
is a "storage directory". The "storage" directory picks up all of
|
||||
its events through pyinotify. (These events are fed to it through
|
||||
StoreWatchListener)
|
||||
"""
|
||||
""" Organizer is responsible to to listening to OrganizeListener
|
||||
events and committing the appropriate changes to the filesystem.
|
||||
It does not in any interact with WatchSyncer's even when the the
|
||||
WatchSyncer is a "storage directory". The "storage" directory picks
|
||||
up all of its events through pyinotify. (These events are fed to it
|
||||
through StoreWatchListener) """
|
||||
|
||||
# Commented out making this class a singleton because it's just a band aid
|
||||
# for the real issue. The real issue being making multiple Organizer
|
||||
|
@ -41,11 +39,9 @@ class Organizer(ReportHandler,Loggable):
|
|||
super(Organizer, self).__init__(signal=self.channel, weak=False)
|
||||
|
||||
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) """
|
||||
# Only handle this event type
|
||||
assert isinstance(event, OrganizeFile), \
|
||||
"Organizer can only handle OrganizeFile events.Given '%s'" % event
|
||||
|
|
Loading…
Reference in New Issue