annotate sat/plugins/plugin_misc_tickets.py @ 2671:0fa217fafabf

tools (common/template), jp: refactoring to handle multiple sites: - site can now be specified in template header before theme, for instance: (some_site/some_theme)path/to/template.ext - absolute template paths are now implemented, but Renderer must be instanciated with trusted to True for security reason (it's the case for jp) - a new "front_url_filter" callable can be given to Renderer, which will convert template path to URL seen by end-user (default to real path). - the "front_url_filter" can be used in templates with… "front_url" filter - template_data is a new named tuple available in templates, which give site, theme and template relative URL - search order is site/theme, site/default_theme, and default/default_theme where default link to sat_pubsub templates - when loading CSS files, files with _noscript suffixes are now loaded, and used when javascript is not available - "styles_extra.css" is also loaded before "styles.css", useful when a theme want to reuse default style, and just override some rules - new site can be specified in sat.conf [DEFAULT] section, using sites_path_public_dict or sites_path_private_dict (where sites_path_private_dict won't be used in public frontends, like Libervia) - "private" argument of Renderer tells the renderer to load private sites or not - templates are now loaded from "templates" subdirectory, to differenciate them from other data like i18n - jp template output has been updated to handle those changes, and to manage absolute templates
author Goffi <goffi@goffi.org>
date Mon, 10 Sep 2018 08:58:18 +0200
parents 56f94936df1e
children 003b8b4b56a7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2404
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
1 #!/usr/bin/env python2
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
3
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
4 # SAT plugin for Pubsub Schemas
2483
0046283a285d dates update
Goffi <goffi@goffi.org>
parents: 2472
diff changeset
5 # Copyright (C) 2009-2018 Jérôme Poisson (goffi@goffi.org)
2404
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
6
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
7 # This program is free software: you can redistribute it and/or modify
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
8 # it under the terms of the GNU Affero General Public License as published by
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
9 # the Free Software Foundation, either version 3 of the License, or
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
10 # (at your option) any later version.
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
11
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
12 # This program is distributed in the hope that it will be useful,
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
15 # GNU Affero General Public License for more details.
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
16
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
17 # You should have received a copy of the GNU Affero General Public License
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
19
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
20 from sat.core.i18n import _
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
21 from sat.core.constants import Const as C
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
22 from twisted.internet import defer
2471
544c4d2fec45 plugins schema, merge_requests, tickets*: factorisation
Goffi <goffi@goffi.org>
parents: 2447
diff changeset
23 from sat.tools.common import uri
2404
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
24 from sat.tools import utils
2471
544c4d2fec45 plugins schema, merge_requests, tickets*: factorisation
Goffi <goffi@goffi.org>
parents: 2447
diff changeset
25 import shortuuid
2404
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
26 from sat.core.log import getLogger
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
27
2404
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
28 log = getLogger(__name__)
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
29
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
30 NS_TICKETS = "org.salut-a-toi.tickets:0"
2404
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
31
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
32 PLUGIN_INFO = {
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
33 C.PI_NAME: _("Tickets management"),
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
34 C.PI_IMPORT_NAME: "TICKETS",
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
35 C.PI_TYPE: "EXP",
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
36 C.PI_PROTOCOLS: [],
2430
3faf18111d61 plugin tickets: fill reporter field when it is not already filled
Goffi <goffi@goffi.org>
parents: 2420
diff changeset
37 C.PI_DEPENDENCIES: ["XEP-0060", "PUBSUB_SCHEMA", "XEP-0277", "IDENTITY"],
2404
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
38 C.PI_MAIN: "Tickets",
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
39 C.PI_HANDLER: "no",
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
40 C.PI_DESCRIPTION: _("""Tickets management plugin"""),
2404
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
41 }
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
42
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
43
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
44 class Tickets(object):
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
45 def __init__(self, host):
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
46 log.info(_(u"Tickets plugin initialization"))
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
47 self.host = host
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
48 host.registerNamespace("tickets", NS_TICKETS)
2404
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
49 self._p = self.host.plugins["XEP-0060"]
f05c884cd3ef plugin tickets: high level tickets handling, first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
50 self._s = self.host.plugins["PUBSUB_SCHEMA"]
2420
03da3ef5fb5b plugin tickets: added ticketsSet and ticketsSchemaGet methods:
Goffi <goffi@goffi.org>
parents: 2404
diff changeset
51 self._m = self.host.plugins["XEP-0277"]
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
52 host.bridge.addMethod(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
53 "ticketsGet",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
54 ".plugin",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
55 in_sign="ssiassa{ss}s",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
56 out_sign="(asa{ss})",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
57 method=utils.partial(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
58 self._s._get,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
59 default_node=NS_TICKETS,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
60 form_ns=NS_TICKETS,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
61 filters={
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
62 u"author": self._s.valueOrPublisherFilter,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
63 u"created": self._s.dateFilter,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
64 u"updated": self._s.dateFilter,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
65 },
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
66 ),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
67 async=True,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
68 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
69 host.bridge.addMethod(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
70 "ticketSet",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
71 ".plugin",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
72 in_sign="ssa{sas}ssa{ss}s",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
73 out_sign="s",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
74 method=self._set,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
75 async=True,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
76 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
77 host.bridge.addMethod(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
78 "ticketsSchemaGet",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
79 ".plugin",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
80 in_sign="sss",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
81 out_sign="s",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
82 method=utils.partial(self._s._getUISchema, default_node=NS_TICKETS),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
83 async=True,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
84 )
2471
544c4d2fec45 plugins schema, merge_requests, tickets*: factorisation
Goffi <goffi@goffi.org>
parents: 2447
diff changeset
85
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
86 def _set(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
87 self,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
88 service,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
89 node,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
90 values,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
91 schema=None,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
92 item_id=None,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
93 extra=None,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
94 profile_key=C.PROF_KEY_NONE,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
95 ):
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
96 client, service, node, schema, item_id, extra = self._s.prepareBridgeSet(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
97 service, node, schema, item_id, extra, profile_key
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
98 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
99 d = self.set(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
100 client, service, node, values, schema, item_id, extra, deserialise=True
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
101 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
102 d.addCallback(lambda ret: ret or u"")
2420
03da3ef5fb5b plugin tickets: added ticketsSet and ticketsSchemaGet methods:
Goffi <goffi@goffi.org>
parents: 2404
diff changeset
103 return d
03da3ef5fb5b plugin tickets: added ticketsSet and ticketsSchemaGet methods:
Goffi <goffi@goffi.org>
parents: 2404
diff changeset
104
03da3ef5fb5b plugin tickets: added ticketsSet and ticketsSchemaGet methods:
Goffi <goffi@goffi.org>
parents: 2404
diff changeset
105 @defer.inlineCallbacks
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
106 def set(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
107 self,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
108 client,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
109 service,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
110 node,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
111 values,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
112 schema=None,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
113 item_id=None,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
114 extra=None,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
115 deserialise=False,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
116 form_ns=NS_TICKETS,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
117 ):
2420
03da3ef5fb5b plugin tickets: added ticketsSet and ticketsSchemaGet methods:
Goffi <goffi@goffi.org>
parents: 2404
diff changeset
118 """Publish a tickets
03da3ef5fb5b plugin tickets: added ticketsSet and ticketsSchemaGet methods:
Goffi <goffi@goffi.org>
parents: 2404
diff changeset
119
03da3ef5fb5b plugin tickets: added ticketsSet and ticketsSchemaGet methods:
Goffi <goffi@goffi.org>
parents: 2404
diff changeset
120 @param node(unicode, None): Pubsub node to use
03da3ef5fb5b plugin tickets: added ticketsSet and ticketsSchemaGet methods:
Goffi <goffi@goffi.org>
parents: 2404
diff changeset
121 None to use default tickets node
2554
0062d3e79d12 plugin uri finder, jp (merge-request): labels handling:
Goffi <goffi@goffi.org>
parents: 2483
diff changeset
122 @param values(dict[key(unicode), [iterable[object]|object]]): values of the ticket
0062d3e79d12 plugin uri finder, jp (merge-request): labels handling:
Goffi <goffi@goffi.org>
parents: 2483
diff changeset
123 if value is not iterable, it will be put in a list
2420
03da3ef5fb5b plugin tickets: added ticketsSet and ticketsSchemaGet methods:
Goffi <goffi@goffi.org>
parents: 2404
diff changeset
124 'created' and 'updated' will be forced to current time:
03da3ef5fb5b plugin tickets: added ticketsSet and ticketsSchemaGet methods:
Goffi <goffi@goffi.org>
parents: 2404
diff changeset
125 - 'created' is set if item_id is None, i.e. if it's a new ticket
03da3ef5fb5b plugin tickets: added ticketsSet and ticketsSchemaGet methods:
Goffi <goffi@goffi.org>
parents: 2404
diff changeset
126 - 'updated' is set everytime
2447
9e692f09f367 plugin tickets: handle "update" flag + various improvments:
Goffi <goffi@goffi.org>
parents: 2443
diff changeset
127 @param extra(dict, None): same as for [XEP-0060.sendItem] with additional keys:
9e692f09f367 plugin tickets: handle "update" flag + various improvments:
Goffi <goffi@goffi.org>
parents: 2443
diff changeset
128 - update(bool): if True, get previous item data to merge with current one
9e692f09f367 plugin tickets: handle "update" flag + various improvments:
Goffi <goffi@goffi.org>
parents: 2443
diff changeset
129 if True, item_id must be None
2420
03da3ef5fb5b plugin tickets: added ticketsSet and ticketsSchemaGet methods:
Goffi <goffi@goffi.org>
parents: 2404
diff changeset
130 other arguments are same as for [self._s.sendDataFormItem]
03da3ef5fb5b plugin tickets: added ticketsSet and ticketsSchemaGet methods:
Goffi <goffi@goffi.org>
parents: 2404
diff changeset
131 @return (unicode): id of the created item
03da3ef5fb5b plugin tickets: added ticketsSet and ticketsSchemaGet methods:
Goffi <goffi@goffi.org>
parents: 2404
diff changeset
132 """
03da3ef5fb5b plugin tickets: added ticketsSet and ticketsSchemaGet methods:
Goffi <goffi@goffi.org>
parents: 2404
diff changeset
133 if not node:
03da3ef5fb5b plugin tickets: added ticketsSet and ticketsSchemaGet methods:
Goffi <goffi@goffi.org>
parents: 2404
diff changeset
134 node = NS_TICKETS
03da3ef5fb5b plugin tickets: added ticketsSet and ticketsSchemaGet methods:
Goffi <goffi@goffi.org>
parents: 2404
diff changeset
135 if not item_id:
2434
7fa9456032e7 plugin tickets: specify parent service when using getCommentsService + fill reporter_jid is missing (will be discarded later if not in the schema)
Goffi <goffi@goffi.org>
parents: 2430
diff changeset
136 comments_service = yield self._m.getCommentsService(client, service)
2420
03da3ef5fb5b plugin tickets: added ticketsSet and ticketsSchemaGet methods:
Goffi <goffi@goffi.org>
parents: 2404
diff changeset
137
03da3ef5fb5b plugin tickets: added ticketsSet and ticketsSchemaGet methods:
Goffi <goffi@goffi.org>
parents: 2404
diff changeset
138 # we need to use uuid for comments node, because we don't know item id in advance
03da3ef5fb5b plugin tickets: added ticketsSet and ticketsSchemaGet methods:
Goffi <goffi@goffi.org>
parents: 2404
diff changeset
139 # (we don't want to set it ourselves to let the server choose, so we can have
03da3ef5fb5b plugin tickets: added ticketsSet and ticketsSchemaGet methods:
Goffi <goffi@goffi.org>
parents: 2404
diff changeset
140 # a nicer id if serial ids is activated)
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
141 comments_node = self._m.getCommentsNode(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
142 node + u"_" + unicode(shortuuid.uuid())
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
143 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
144 options = {
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
145 self._p.OPT_ACCESS_MODEL: self._p.ACCESS_OPEN,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
146 self._p.OPT_PERSIST_ITEMS: 1,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
147 self._p.OPT_MAX_ITEMS: -1,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
148 self._p.OPT_DELIVER_PAYLOADS: 1,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
149 self._p.OPT_SEND_ITEM_SUBSCRIBE: 1,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
150 self._p.OPT_PUBLISH_MODEL: self._p.ACCESS_OPEN,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
151 }
2420
03da3ef5fb5b plugin tickets: added ticketsSet and ticketsSchemaGet methods:
Goffi <goffi@goffi.org>
parents: 2404
diff changeset
152 yield self._p.createNode(client, comments_service, comments_node, options)
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
153 values["comments_uri"] = uri.buildXMPPUri(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
154 u"pubsub",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
155 subtype="microblog",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
156 path=comments_service.full(),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
157 node=comments_node,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
158 )
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
159 item_id = yield self._s.set(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
160 client, service, node, values, schema, item_id, extra, deserialise, form_ns
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2603
diff changeset
161 )
2420
03da3ef5fb5b plugin tickets: added ticketsSet and ticketsSchemaGet methods:
Goffi <goffi@goffi.org>
parents: 2404
diff changeset
162 defer.returnValue(item_id)