comparison libervia/pages/blog/view/page_meta.py @ 1137:dfd6545a205a

pages (blog/view, tickets): use of new "order_by" feature.
author Goffi <goffi@goffi.org>
date Sun, 06 Jan 2019 17:45:44 +0100
parents 122dd136d1ab
children e1a953512f72
comparison
equal deleted inserted replaced
1136:ab78374e1117 1137:dfd6545a205a
105 comments_data = yield self.host.bridgeCall(u'mbGet', 105 comments_data = yield self.host.bridgeCall(u'mbGet',
106 service, 106 service,
107 node, 107 node,
108 C.NO_LIMIT, 108 C.NO_LIMIT,
109 [], 109 [],
110 {}, 110 {C.KEY_ORDER_BY: C.ORDER_BY_CREATION},
111 profile) 111 profile)
112 except Exception as e: 112 except Exception as e:
113 log.warning(_(u"Can't get comments at {node} (service: {service}): {msg}").format( 113 log.warning(_(u"Can't get comments at {node} (service: {service}): {msg}").format(
114 service=service, 114 service=service,
115 node=node, 115 node=node,
161 ## pagination/filtering parameters 161 ## pagination/filtering parameters
162 params = self.getAllPostedData(request, multiple=False) 162 params = self.getAllPostedData(request, multiple=False)
163 if item_id: 163 if item_id:
164 extra = {} 164 extra = {}
165 else: 165 else:
166 extra = {u'rsm_max': u'10'} 166 extra = {
167 C.KEY_ORDER_BY: C.ORDER_BY_CREATION,
168 u'rsm_max': u'10',
169 }
167 if u'after' in params: 170 if u'after' in params:
168 extra[u'rsm_after'] = params[u'after'] 171 extra[u'rsm_after'] = params[u'after']
169 elif u'before' in params: 172 elif u'before' in params:
170 extra[u'rsm_before'] = params[u'before'] 173 extra[u'rsm_before'] = params[u'before']
171 tag = data.get('tag') 174 tag = data.get('tag')
197 # if item id has been specified in URL and it's not found, 200 # if item id has been specified in URL and it's not found,
198 # we must return an error 201 # we must return an error
199 self.pageError(request, C.HTTP_NOT_FOUND) 202 self.pageError(request, C.HTTP_NOT_FOUND)
200 203
201 # no items, we have requested items before last post, or blog is empty 204 # no items, we have requested items before last post, or blog is empty
202 extra = {u'rsm_max': u'10'} 205 extra = {
206 C.KEY_ORDER_BY: C.ORDER_BY_CREATION,
207 u'rsm_max': u'10',
208 }
203 blog_data, items = yield getBlogData(self, request, service, node, None, extra, profile) 209 blog_data, items = yield getBlogData(self, request, service, node, None, extra, profile)
204 if items: 210 if items:
205 last_id = items[-1].id 211 last_id = items[-1].id
206 template_data['older_url'] = self.getParamURL(request, after=last_id) 212 template_data['older_url'] = self.getParamURL(request, after=last_id)
207 213