diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-07-14 14:40:45 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-07-14 14:40:45 (GMT) |
commit | db08c3795f5e02245477126e8eb19e0049303332 (patch) | |
tree | 20c3b420a8f3221ed8ec0b46e896269d3e28c978 /shell/ActivityRegistry.py | |
parent | 5ff09a10f7fe85c78c911b0393d88a4b2095cb5d (diff) |
Read service type from the .activity file
Diffstat (limited to 'shell/ActivityRegistry.py')
-rw-r--r-- | shell/ActivityRegistry.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/shell/ActivityRegistry.py b/shell/ActivityRegistry.py index 957d436..6d296bb 100644 --- a/shell/ActivityRegistry.py +++ b/shell/ActivityRegistry.py @@ -29,6 +29,14 @@ class ActivityModule: def get_directory(self): """Get the path to activity directory.""" return self._directory + + def get_default_type(self): + """Get the the type of the default activity service.""" + return self._default_type + + def set_default_type(self, default_type): + """Set the the type of the default activity service.""" + self._default_type = default_type class ActivityRegistry: """Service that tracks the available activities""" @@ -65,12 +73,20 @@ class ActivityRegistry: logging.error('%s miss the required name option' % (path)) return False + if cp.has_option('Activity', 'default_type'): + default_type = cp.get('Activity', 'default_type') + else: + default_type = None + if cp.has_option('Activity', 'exec'): activity_exec = cp.get('Activity', 'exec') elif cp.has_option('Activity', 'python_module'): python_module = cp.get('Activity', 'python_module') + python_module = cp.get('Activity', 'python_module') activity_exec = '%s %s %s' % (env.get_activity_runner(), activity_id, python_module) + if default_type: + activity_exec += ' ' + default_type env.add_to_python_path(directory) else: logging.error('%s must specifiy exec or python_module' % (path)) @@ -79,6 +95,8 @@ class ActivityRegistry: module = ActivityModule(name, activity_id, activity_exec, directory) self._activities.append(module) + module.set_default_type(default_type) + return True def list_activities(self): |