Change utility for determining event or superevent

We now check whether the object ID is an event or not, rather
than whether it is a superevent or not.  This is because the
superevent prefixes will likely be changing in the near future,
but the event prefixes are pretty well fixed.
parent 41dc0cfa
......@@ -10,18 +10,17 @@ from subprocess import Popen, PIPE
if os.name == 'posix':
import pwd
SUPEREVENT_PREFIXES = ['S', 'TS', 'MS', 'GW', 'TGW', 'MGW']
superevent_prefix_regex = re.compile(r'^({prefixes})\d+'.format(
prefixes="|".join(SUPEREVENT_PREFIXES)))
EVENT_PREFIXES = ['G', 'E', 'H', 'M', 'T']
event_prefix_regex = re.compile(r'^({prefixes})\d+'.format(
prefixes="|".join(EVENT_PREFIXES)))
# Decorator for class methods so that they work for events or superevents
def event_or_superevent(func):
@wraps(func)
def inner(self, object_id, *args, **kwargs):
is_superevent = False
if superevent_prefix_regex.match(object_id):
is_superevent = True
is_superevent = True
if event_prefix_regex.match(object_id):
is_superevent = False
return func(self, object_id, is_superevent=is_superevent, *args,
**kwargs)
return inner
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment