14564.3.1
by Jeroen Vermeulen
Lint. |
1 |
# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
|
8687.15.18
by Karl Fogel
Add the copyright header block to files under lib/canonical/. |
2 |
# GNU Affero General Public License version 3 (see the file LICENSE).
|
3 |
||
6002.3.14
by Graham Binns
Review fixes for bac. |
4 |
# pylint: disable-msg=E0211,E0213
|
4823.6.6
by Barry Warsaw
As per Steve's recommendation, move the 'mailinglists' end point to |
5 |
|
6 |
"""XML-RPC API to the application roots."""
|
|
3258.4.1
by Steve Alexander
Disable trebuchet. Make XMLRPC work, with an (untested) self-check API. |
7 |
|
8 |
__metaclass__ = type |
|
4823.6.6
by Barry Warsaw
As per Steve's recommendation, move the 'mailinglists' end point to |
9 |
|
10 |
__all__ = [ |
|
11 |
'ISelfTest', |
|
12 |
'PrivateApplication', |
|
13 |
'SelfTest', |
|
14 |
]
|
|
3258.4.1
by Steve Alexander
Disable trebuchet. Make XMLRPC work, with an (untested) self-check API. |
15 |
|
3673.5.11
by Bjorn Tillenius
make sure interactions work as the should. move/delete some code from helpers.py |
16 |
import xmlrpclib |
17 |
||
18 |
from zope.component import getUtility |
|
11403.1.4
by Henning Eggers
Reformatted imports using format-imports script r32. |
19 |
from zope.interface import ( |
20 |
implements, |
|
21 |
Interface, |
|
22 |
)
|
|
3258.4.1
by Steve Alexander
Disable trebuchet. Make XMLRPC work, with an (untested) self-check API. |
23 |
|
11403.1.4
by Henning Eggers
Reformatted imports using format-imports script r32. |
24 |
from canonical.launchpad.webapp import LaunchpadXMLRPCView |
11882.2.2
by Jonathan Lange
Clear up a heck of a lot of imports from canonical.launchpad.interfaces. |
25 |
from canonical.launchpad.webapp.interfaces import ILaunchBag |
14593.1.5
by Curtis Hovey
Moved IPrivateApplication to lp.xmlrpc. |
26 |
from lp.xmlrpc.interfaces import IPrivateApplication |
14560.2.16
by Curtis Hovey
Moved IPrivateMaloneApplication to lp.bugs. |
27 |
from lp.bugs.interfaces.malone import IPrivateMaloneApplication |
9590.1.48
by Michael Hudson
a start at combining the puller and filesystem endpoints |
28 |
from lp.code.interfaces.codehosting import ICodehostingApplication |
8590.2.2
by Tim Penhey
Fix the fallout in the zcml and other imports. |
29 |
from lp.code.interfaces.codeimportscheduler import ( |
11403.1.4
by Henning Eggers
Reformatted imports using format-imports script r32. |
30 |
ICodeImportSchedulerApplication, |
31 |
)
|
|
11882.2.2
by Jonathan Lange
Clear up a heck of a lot of imports from canonical.launchpad.interfaces. |
32 |
from lp.registry.interfaces.mailinglist import IMailingListApplication |
7675.738.15
by Michael Nelson
Rename from general IPersonSetApplication to ISoftwareCenterAgentApplication etc. |
33 |
from lp.registry.interfaces.person import ISoftwareCenterAgentApplication |
14578.3.1
by William Grant
Extract all the authserver stuff to lp.services.authserver. |
34 |
from lp.services.authserver.interfaces import IAuthServerApplication |
14011.3.1
by Michael-Doyle Hudson
revert the reversion of the xmlrpc feature flag endpoint |
35 |
from lp.services.features.xmlrpc import IFeatureFlagApplication |
4823.6.6
by Barry Warsaw
As per Steve's recommendation, move the 'mailinglists' end point to |
36 |
|
14585.1.1
by William Grant
Drop the (hopefully) unused RosettaSelfTest XML-RPC view. |
37 |
|
12929.6.6
by Francis J. Lacoste
Update the regexp so that all categories work and define a partition. |
38 |
# NOTE: If you add a traversal here, you should update
|
39 |
# the regular expression in utilities/page-performance-report.ini
|
|
4823.6.6
by Barry Warsaw
As per Steve's recommendation, move the 'mailinglists' end point to |
40 |
class PrivateApplication: |
4823.6.7
by Barry Warsaw
Much simplification and improvement in the way private ports are done. |
41 |
implements(IPrivateApplication) |
4823.6.6
by Barry Warsaw
As per Steve's recommendation, move the 'mailinglists' end point to |
42 |
|
43 |
@property
|
|
44 |
def mailinglists(self): |
|
5052.1.1
by Francis J. Lacoste
Add stub AuthServer API to IPrivateApplication. |
45 |
"""See `IPrivateApplication`."""
|
4823.6.6
by Barry Warsaw
As per Steve's recommendation, move the 'mailinglists' end point to |
46 |
return getUtility(IMailingListApplication) |
47 |
||
5052.1.1
by Francis J. Lacoste
Add stub AuthServer API to IPrivateApplication. |
48 |
@property
|
49 |
def authserver(self): |
|
50 |
"""See `IPrivateApplication`."""
|
|
51 |
return getUtility(IAuthServerApplication) |
|
52 |
||
5354.1.3
by Michael Hudson
make the test pass |
53 |
@property
|
9590.1.48
by Michael Hudson
a start at combining the puller and filesystem endpoints |
54 |
def codehosting(self): |
55 |
"""See `IPrivateApplication`."""
|
|
56 |
return getUtility(ICodehostingApplication) |
|
6789.8.2
by Michael Hudson
brainless cargo culting to add the 'branchfilesystem' endpoint. |
57 |
|
58 |
@property
|
|
5354.1.3
by Michael Hudson
make the test pass |
59 |
def codeimportscheduler(self): |
60 |
"""See `IPrivateApplication`."""
|
|
61 |
return getUtility(ICodeImportSchedulerApplication) |
|
62 |
||
6002.3.7
by Graham Binns
Added implementation of bugtracker token stuff. Can't get the XML-RPC interface working yet. |
63 |
@property
|
6002.3.13
by Graham Binns
Altered other tests. |
64 |
def bugs(self): |
6002.3.7
by Graham Binns
Added implementation of bugtracker token stuff. Can't get the XML-RPC interface working yet. |
65 |
"""See `IPrivateApplication`."""
|
6002.3.11
by Graham Binns
Renamed IExternalBugTrackerTokenApplication to IPrivateMaloneApplication. |
66 |
return getUtility(IPrivateMaloneApplication) |
6002.3.7
by Graham Binns
Added implementation of bugtracker token stuff. Can't get the XML-RPC interface working yet. |
67 |
|
7675.738.9
by Michael Nelson
Intermediate work for private xmlrpc exposure. |
68 |
@property
|
7675.738.15
by Michael Nelson
Rename from general IPersonSetApplication to ISoftwareCenterAgentApplication etc. |
69 |
def softwarecenteragent(self): |
7675.738.9
by Michael Nelson
Intermediate work for private xmlrpc exposure. |
70 |
"""See `IPrivateApplication`."""
|
7675.738.15
by Michael Nelson
Rename from general IPersonSetApplication to ISoftwareCenterAgentApplication etc. |
71 |
return getUtility(ISoftwareCenterAgentApplication) |
7675.738.9
by Michael Nelson
Intermediate work for private xmlrpc exposure. |
72 |
|
14011.3.1
by Michael-Doyle Hudson
revert the reversion of the xmlrpc feature flag endpoint |
73 |
@property
|
74 |
def featureflags(self): |
|
75 |
"""See `IPrivateApplication`."""
|
|
76 |
return getUtility(IFeatureFlagApplication) |
|
77 |
||
4823.6.6
by Barry Warsaw
As per Steve's recommendation, move the 'mailinglists' end point to |
78 |
|
3258.4.1
by Steve Alexander
Disable trebuchet. Make XMLRPC work, with an (untested) self-check API. |
79 |
class ISelfTest(Interface): |
80 |
"""XMLRPC external interface for testing the XMLRPC external interface."""
|
|
81 |
||
82 |
def make_fault(): |
|
83 |
"""Returns an xmlrpc fault."""
|
|
84 |
||
85 |
def concatenate(string1, string2): |
|
86 |
"""Return the concatenation of the two given strings."""
|
|
87 |
||
3673.5.11
by Bjorn Tillenius
make sure interactions work as the should. move/delete some code from helpers.py |
88 |
def hello(): |
89 |
"""Return a greeting to the one calling the method."""
|
|
90 |
||
4246.2.1
by James Henstridge
catch non-Fault exceptions in XML-RPC and display the OOPS code |
91 |
def raise_exception(): |
92 |
"""Raise an exception."""
|
|
93 |
||
3673.5.11
by Bjorn Tillenius
make sure interactions work as the should. move/delete some code from helpers.py |
94 |
|
3258.4.1
by Steve Alexander
Disable trebuchet. Make XMLRPC work, with an (untested) self-check API. |
95 |
class SelfTest(LaunchpadXMLRPCView): |
96 |
||
97 |
implements(ISelfTest) |
|
98 |
||
99 |
def make_fault(self): |
|
100 |
"""Returns an xmlrpc fault."""
|
|
101 |
return xmlrpclib.Fault(666, "Yoghurt and spanners.") |
|
102 |
||
103 |
def concatenate(self, string1, string2): |
|
104 |
"""Return the concatenation of the two given strings."""
|
|
105 |
return u'%s %s' % (string1, string2) |
|
106 |
||
3673.5.11
by Bjorn Tillenius
make sure interactions work as the should. move/delete some code from helpers.py |
107 |
def hello(self): |
108 |
"""Return a greeting to the logged in user."""
|
|
109 |
caller = getUtility(ILaunchBag).user |
|
110 |
if caller is not None: |
|
111 |
caller_name = caller.displayname |
|
112 |
else: |
|
113 |
caller_name = "Anonymous" |
|
114 |
return "Hello %s." % caller_name |
|
115 |
||
4246.2.1
by James Henstridge
catch non-Fault exceptions in XML-RPC and display the OOPS code |
116 |
def raise_exception(self): |
117 |
raise RuntimeError("selftest exception") |