entity.py
changeset 4363 5c18d82042fb
parent 4252 6c4f109c2b03
child 4436 294e084f1263
equal deleted inserted replaced
4362:817851a77e27 4363:5c18d82042fb
   314             if value is None or unicode(value) == u'':
   314             if value is None or unicode(value) == u'':
   315                 mainattr = 'eid'
   315                 mainattr = 'eid'
   316                 path += '/eid'
   316                 path += '/eid'
   317             elif needcheck:
   317             elif needcheck:
   318                 # make sure url is not ambiguous
   318                 # make sure url is not ambiguous
   319                 rql = 'Any COUNT(X) WHERE X is %s, X %s %%(value)s' % (
   319                 try:
   320                     etype, mainattr)
   320                     nbresults = self.__unique
   321                 nbresults = self._cw.execute(rql, {'value' : value})[0][0]
   321                 except AttributeError:
       
   322                     rql = 'Any COUNT(X) WHERE X is %s, X %s %%(value)s' % (
       
   323                         etype, mainattr)
       
   324                     nbresults = self.__unique = self._cw.execute(rql, {'value' : value})[0][0]
   322                 if nbresults != 1: # ambiguity?
   325                 if nbresults != 1: # ambiguity?
   323                     mainattr = 'eid'
   326                     mainattr = 'eid'
   324                     path += '/eid'
   327                     path += '/eid'
   325         if mainattr == 'eid':
   328         if mainattr == 'eid':
   326             if use_ext_eid:
   329             if use_ext_eid: