1
2
3 __doc__ = """
4 Represents an APP service entity.
5 """
6
7 from bridge import Element, Attribute
8 from bridge.common import ATOM10_PREFIX, ATOMPUB_PREFIX, ATOMPUB_NS
9
12 """
13 APP service entity.
14
15 Keyword arguments:
16 store -- An amplee.atompub.AtomPubStore instance
17 """
18 self.store = store
19
20
21
22 self.workspaces = []
23
24 - def to_service(self, prefix=ATOMPUB_PREFIX, namespace=ATOMPUB_NS):
25 """
26 Generates and returns a bridge.Element instance of the service
27 document and its workspaces.
28
29 Keyword arguments:
30 prefix -- XML prefix to use (default:%s)
31 namespace -- Namespace associated with the service document
32 (default:%s)
33
34 """ % (ATOMPUB_PREFIX, ATOMPUB_NS)
35 service = Element(u'service', prefix=prefix, namespace=namespace)
36 service.workspace = []
37 for workspace in self.workspaces:
38 ws = workspace.workspace
39 ws.parent = service
40 service.xml_children.append(ws)
41 service.workspace.append(ws)
42
43 return service
44 service = property(to_service)
45