equal
deleted
inserted
replaced
202 def build_url(self, *args, **kwargs): |
202 def build_url(self, *args, **kwargs): |
203 """return an absolute URL using params dictionary key/values as URL |
203 """return an absolute URL using params dictionary key/values as URL |
204 parameters. Values are automatically URL quoted, and the |
204 parameters. Values are automatically URL quoted, and the |
205 publishing method to use may be specified or will be guessed. |
205 publishing method to use may be specified or will be guessed. |
206 |
206 |
|
207 if ``__secure__`` argument is True, the request will try to build a |
|
208 https url. |
|
209 |
207 raises :exc:`ValueError` if None is found in arguments |
210 raises :exc:`ValueError` if None is found in arguments |
208 """ |
211 """ |
209 # use *args since we don't want first argument to be "anonymous" to |
212 # use *args since we don't want first argument to be "anonymous" to |
210 # avoid potential clash with kwargs |
213 # avoid potential clash with kwargs |
211 if args: |
214 if args: |
220 method = self.relative_path(includeparams=False) or 'view' |
223 method = self.relative_path(includeparams=False) or 'view' |
221 else: |
224 else: |
222 method = 'view' |
225 method = 'view' |
223 base_url = kwargs.pop('base_url', None) |
226 base_url = kwargs.pop('base_url', None) |
224 if base_url is None: |
227 if base_url is None: |
225 base_url = self.base_url() |
228 secure = kwargs.pop('__secure__', None) |
|
229 base_url = self.base_url(secure=secure) |
226 if '_restpath' in kwargs: |
230 if '_restpath' in kwargs: |
227 assert method == 'view', method |
231 assert method == 'view', method |
228 path = kwargs.pop('_restpath') |
232 path = kwargs.pop('_restpath') |
229 else: |
233 else: |
230 path = method |
234 path = method |
413 return todate(dt) |
417 return todate(dt) |
414 except ValueError: |
418 except ValueError: |
415 raise ValueError(self._('can\'t parse %(value)r (expected %(format)s)') |
419 raise ValueError(self._('can\'t parse %(value)r (expected %(format)s)') |
416 % {'value': value, 'format': format}) |
420 % {'value': value, 'format': format}) |
417 |
421 |
418 def base_url(self): |
422 def base_url(self, secure=None): |
419 """return the root url of the instance""" |
423 """return the root url of the instance |
|
424 """ |
|
425 if secure: |
|
426 raise NotImplementedError() |
420 return self.vreg.config['base-url'] |
427 return self.vreg.config['base-url'] |
421 |
428 |
422 # abstract methods to override according to the web front-end ############# |
429 # abstract methods to override according to the web front-end ############# |
423 |
430 |
424 def describe(self, eid, asdict=False): |
431 def describe(self, eid, asdict=False): |