Projects
Kolab:Winterfell
bonnie
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 3
View file
bonnie-0.3.2.tar.gz/bonnie/worker/handlers/changelog.py -> bonnie-0.3.4.tar.gz/bonnie/worker/handlers/changelog.py
Changed
@@ -25,7 +25,6 @@ import time import bonnie -from dateutil.tz import tzutc from bonnie.worker.handlers import HandlerBase log = bonnie.getLogger('bonnie.worker.changelog') @@ -33,40 +32,71 @@ # timestamp (* 10) at the year 2014 REVBASE = 13885344000 + class ChangelogHandler(HandlerBase): - events = ['MessageAppend','vnd.cmu.MessageMove'] + events = ['MessageAppend', 'vnd.cmu.MessageMove'] def __init__(self, *args, **kw): HandlerBase.__init__(self, *args, **kw) def register(self, callback): - kw = { 'callback': self.run } - interests = dict((event,kw) for event in self.events) + kw = {'callback': self.run} + interests = dict((event, kw) for event in self.events) self.worker = callback(interests) def run(self, notification): # message notifications require message headers if not notification.has_key('messageHeaders'): - return (notification, [ b"FETCH" ] if notification['event'] == 'MessageAppend' else [ b"HEADER" ]) + if notification['event'] == 'MessageAppend': + return (notification, [b"FETCH"]) + else: + return (notification, [b"HEADER"]) # check if this is a groupware object object_type = None - msguid = notification['uidset'] if notification.has_key('uidset') else None - headers = notification['messageHeaders'][msguid] if notification['messageHeaders'].has_key(msguid) else None - if headers and headers.has_key('X-Kolab-Type') and headers.has_key('Subject'): - match = re.match(r"application/x-vnd.kolab.(\w+)", headers['X-Kolab-Type']) - if match: - object_type = match.group(1) + + if notification.has_key('uidset'): + msguid = notification['uidset'] + else: + msguid = None + + # TODO: May need to iterate over message UIDs + if isinstance(msguid, list): + msguid = msguid.pop() + + if notification['messageHeaders'].has_key(msguid): + headers = notification['messageHeaders'][msguid] + else: + headers = None + + if headers: + if headers.has_key('X-Kolab-Type') and headers.has_key('Subject'): + match = re.match( + r"application/x-vnd.kolab.(\w+)", + headers['X-Kolab-Type'] + ) + + if match: + object_type = match.group(1) # assign a revision number based on the current time if object_type is not None: notification['revision'] = int(round(time.time() * 10 - REVBASE)) + # TODO: save object type and UUID in separate fields? - # These are translated into headers.X-Kolab-Type and headers.Subject by the output module + # These are translated into headers.X-Kolab-Type and + # headers.Subject by the output module - log.debug("Object type %r detected in event %r" % (object_type, notification['event']), level=8) + log.debug( + "Object type %r detected in event %r" % ( + object_type, + notification['event'] + ), + level=8 + ) - # TODO: suppress MessageTrash/MessageExpunge events when followed by a MessageAppend for the same object + # TODO: suppress MessageTrash/MessageExpunge events when followed by a + # MessageAppend for the same object return (notification, [])
View file
bonnie-0.3.4.tar.gz/contrib/bonnie-broker.systemd
Added
@@ -0,0 +1,17 @@ +[Unit] +Description=Wallace Content Filter +After=syslog.target network.target + +[Service] +Type=forking +PIDFile=/run/bonnie/bonnie-broker.pid +User=bonnie +Group=bonnie +EnvironmentFile=/etc/sysconfig/bonnie-broker +ExecStart=/usr/sbin/bonnie-broker $FLAGS --pid-file /run/bonnie/bonnie-broker.pid +ExecReload=/bin/kill -HUP $MAINPID +ExecStop=/bin/kill -TERM $MAINPID + +[Install] +WantedBy=multi-user.target +
View file
bonnie-0.3.4.tar.gz/contrib/bonnie-collector.systemd
Added
@@ -0,0 +1,17 @@ +[Unit] +Description=Wallace Content Filter +After=syslog.target network.target + +[Service] +Type=forking +PIDFile=/run/bonnie/bonnie-collector.pid +User=bonnie +Group=bonnie +EnvironmentFile=/etc/sysconfig/bonnie-collector +ExecStart=/usr/sbin/bonnie-collector $FLAGS --pid-file /run/bonnie/bonnie-collector.pid +ExecReload=/bin/kill -HUP $MAINPID +ExecStop=/bin/kill -TERM $MAINPID + +[Install] +WantedBy=multi-user.target +
View file
bonnie-0.3.4.tar.gz/contrib/bonnie-worker.systemd
Added
@@ -0,0 +1,17 @@ +[Unit] +Description=Wallace Content Filter +After=syslog.target network.target + +[Service] +Type=forking +PIDFile=/run/bonnie/bonnie-worker.pid +User=bonnie +Group=bonnie +EnvironmentFile=/etc/sysconfig/bonnie-worker +ExecStart=/usr/sbin/bonnie-worker $FLAGS --pid-file /run/bonnie/bonnie-worker.pid +ExecReload=/bin/kill -HUP $MAINPID +ExecStop=/bin/kill -TERM $MAINPID + +[Install] +WantedBy=multi-user.target +
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.