Mercurial > libervia-backend
comparison sat/plugins/plugin_misc_tickets.py @ 2785:f18d8315929e
merge_requests: use XHTML for body
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 19 Jan 2019 11:39:02 +0100 |
parents | 003b8b4b56a7 |
children | 989b622faff6 |
comparison
equal
deleted
inserted
replaced
2784:76ebecdb9b1e | 2785:f18d8315929e |
---|---|
81 out_sign="s", | 81 out_sign="s", |
82 method=utils.partial(self._s._getUISchema, default_node=NS_TICKETS), | 82 method=utils.partial(self._s._getUISchema, default_node=NS_TICKETS), |
83 async=True, | 83 async=True, |
84 ) | 84 ) |
85 | 85 |
86 def _set( | 86 def _set(self, service, node, values, schema=None, item_id=None, extra=None, |
87 self, | 87 profile_key=C.PROF_KEY_NONE): |
88 service, | |
89 node, | |
90 values, | |
91 schema=None, | |
92 item_id=None, | |
93 extra=None, | |
94 profile_key=C.PROF_KEY_NONE, | |
95 ): | |
96 client, service, node, schema, item_id, extra = self._s.prepareBridgeSet( | 88 client, service, node, schema, item_id, extra = self._s.prepareBridgeSet( |
97 service, node, schema, item_id, extra, profile_key | 89 service, node, schema, item_id, extra, profile_key |
98 ) | 90 ) |
99 d = self.set( | 91 d = self.set( |
100 client, service, node, values, schema, item_id, extra, deserialise=True | 92 client, service, node, values, schema, item_id, extra, deserialise=True |
101 ) | 93 ) |
102 d.addCallback(lambda ret: ret or u"") | 94 d.addCallback(lambda ret: ret or u"") |
103 return d | 95 return d |
104 | 96 |
105 @defer.inlineCallbacks | 97 @defer.inlineCallbacks |
106 def set( | 98 def set(self, client, service, node, values, schema=None, item_id=None, extra=None, |
107 self, | 99 deserialise=False, form_ns=NS_TICKETS): |
108 client, | |
109 service, | |
110 node, | |
111 values, | |
112 schema=None, | |
113 item_id=None, | |
114 extra=None, | |
115 deserialise=False, | |
116 form_ns=NS_TICKETS, | |
117 ): | |
118 """Publish a tickets | 100 """Publish a tickets |
119 | 101 |
120 @param node(unicode, None): Pubsub node to use | 102 @param node(unicode, None): Pubsub node to use |
121 None to use default tickets node | 103 None to use default tickets node |
122 @param values(dict[key(unicode), [iterable[object]|object]]): values of the ticket | 104 @param values(dict[key(unicode), [iterable[object]|object]]): values of the ticket |
133 if not node: | 115 if not node: |
134 node = NS_TICKETS | 116 node = NS_TICKETS |
135 if not item_id: | 117 if not item_id: |
136 comments_service = yield self._m.getCommentsService(client, service) | 118 comments_service = yield self._m.getCommentsService(client, service) |
137 | 119 |
138 # we need to use uuid for comments node, because we don't know item id in advance | 120 # we need to use uuid for comments node, because we don't know item id in |
139 # (we don't want to set it ourselves to let the server choose, so we can have | 121 # advance (we don't want to set it ourselves to let the server choose, so we |
140 # a nicer id if serial ids is activated) | 122 # can have a nicer id if serial ids is activated) |
141 comments_node = self._m.getCommentsNode( | 123 comments_node = self._m.getCommentsNode( |
142 node + u"_" + unicode(shortuuid.uuid()) | 124 node + u"_" + unicode(shortuuid.uuid()) |
143 ) | 125 ) |
144 options = { | 126 options = { |
145 self._p.OPT_ACCESS_MODEL: self._p.ACCESS_OPEN, | 127 self._p.OPT_ACCESS_MODEL: self._p.ACCESS_OPEN, |