diff options
Diffstat (limited to 'activity/xmlrpc')
-rw-r--r-- | activity/xmlrpc/StartActivity.py | 19 | ||||
-rw-r--r-- | activity/xmlrpc/StopActivity.py | 19 | ||||
-rw-r--r-- | activity/xmlrpc/__init__.py | 5 |
3 files changed, 43 insertions, 0 deletions
diff --git a/activity/xmlrpc/StartActivity.py b/activity/xmlrpc/StartActivity.py new file mode 100644 index 0000000..b5e52c7 --- /dev/null +++ b/activity/xmlrpc/StartActivity.py | |||
@@ -0,0 +1,19 @@ | |||
1 | import xmlrpclib | ||
2 | from .._activitybase import ActivityAction | ||
3 | |||
4 | |||
5 | def execute(self, pagename, description): | ||
6 | action = ActivityAction(self._instr(pagename), self.request) | ||
7 | |||
8 | if not action.page.exists(): | ||
9 | return self.noSuchPageFault() | ||
10 | |||
11 | if not self.request.user.may.write(pagename): | ||
12 | return self.notAllowedFault() | ||
13 | |||
14 | if not action.can_use_activity: | ||
15 | return xmlrpclib.Fault(1, "This page does not support activities.") | ||
16 | |||
17 | action.start_activity(self._instr(description)) | ||
18 | |||
19 | return self._outstr('OK') | ||
diff --git a/activity/xmlrpc/StopActivity.py b/activity/xmlrpc/StopActivity.py new file mode 100644 index 0000000..b26d8dd --- /dev/null +++ b/activity/xmlrpc/StopActivity.py | |||
@@ -0,0 +1,19 @@ | |||
1 | import xmlrpclib | ||
2 | from .._activitybase import ActivityAction | ||
3 | |||
4 | |||
5 | def execute(self, pagename): | ||
6 | action = ActivityAction(self._instr(pagename), self.request) | ||
7 | |||
8 | if not action.page.exists(): | ||
9 | return self.noSuchPageFault() | ||
10 | |||
11 | if not self.request.user.may.write(pagename): | ||
12 | return self.notAllowedFault() | ||
13 | |||
14 | if not action.can_use_activity: | ||
15 | return xmlrpclib.Fault(1, "This page does not support activities.") | ||
16 | |||
17 | action.stop_activity() | ||
18 | |||
19 | return self._outstr('OK') | ||
diff --git a/activity/xmlrpc/__init__.py b/activity/xmlrpc/__init__.py new file mode 100644 index 0000000..e4ed3b6 --- /dev/null +++ b/activity/xmlrpc/__init__.py | |||
@@ -0,0 +1,5 @@ | |||
1 | # -*- coding: iso-8859-1 -*- | ||
2 | |||
3 | from MoinMoin.util import pysupport | ||
4 | |||
5 | modules = pysupport.getPackageModules(__file__) | ||