equal
deleted
inserted
replaced
377 # in linksearch mode, we don't want external urls else selecting |
377 # in linksearch mode, we don't want external urls else selecting |
378 # the object for use in the relation is tricky |
378 # the object for use in the relation is tricky |
379 # XXX search_state is web specific |
379 # XXX search_state is web specific |
380 if getattr(self.req, 'search_state', ('normal',))[0] == 'normal': |
380 if getattr(self.req, 'search_state', ('normal',))[0] == 'normal': |
381 kwargs['base_url'] = self.metainformation()['source'].get('base-url') |
381 kwargs['base_url'] = self.metainformation()['source'].get('base-url') |
382 if method is None or method == 'view': |
382 if method in (None, 'view'): |
383 try: |
383 try: |
384 kwargs['_restpath'] = self.rest_path(kwargs.get('base_url')) |
384 kwargs['_restpath'] = self.rest_path(kwargs.get('base_url')) |
385 except TypeError: |
385 except TypeError: |
386 warn('%s: rest_path() now take use_ext_eid argument, ' |
386 warn('%s: rest_path() now take use_ext_eid argument, ' |
387 'please update' % self.id, DeprecationWarning) |
387 'please update' % self.id, DeprecationWarning) |
402 path += '/eid' |
402 path += '/eid' |
403 elif needcheck: |
403 elif needcheck: |
404 # make sure url is not ambiguous |
404 # make sure url is not ambiguous |
405 rql = 'Any COUNT(X) WHERE X is %s, X %s %%(value)s' % ( |
405 rql = 'Any COUNT(X) WHERE X is %s, X %s %%(value)s' % ( |
406 etype, mainattr) |
406 etype, mainattr) |
407 if value is not None: |
407 nbresults = self.req.execute(rql, {'value' : value})[0][0] |
408 nbresults = self.req.execute(rql, {'value' : value})[0][0] |
408 if nbresults != 1: # ambiguity? |
409 if nbresults != 1: # ambiguity? |
409 mainattr = 'eid' |
410 mainattr = 'eid' |
410 path += '/eid' |
411 path += '/eid' |
|
412 if mainattr == 'eid': |
411 if mainattr == 'eid': |
413 if use_ext_eid: |
412 if use_ext_eid: |
414 value = self.metainformation()['extid'] |
413 value = self.metainformation()['extid'] |
415 else: |
414 else: |
416 value = self.eid |
415 value = self.eid |