drop typed_eid() in favour of int() (closes #2742462)

typed_eid was introduced to abstract the eid type when running on Google AppEngine. It is not used anymore and can be removed. Let's use int() instead.

authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
changesetf5027f8d2478
branchdefault
phasepublic
hiddenno
parent revision#c0d4244e5abc merge with stable
child revision#9db7580d6427 add a command to compare db schema and file system schema (closes #464991)
files modified by this revision
__init__.py
entities/__init__.py
entity.py
req.py
rqlrewrite.py
server/querier.py
server/repository.py
server/schemaserial.py
server/ssplanner.py
sobjects/cwxmlparser.py
sobjects/textparsers.py
web/facet.py
web/views/autoform.py
web/views/basecontrollers.py
web/views/bookmark.py
web/views/editcontroller.py
web/views/editviews.py
web/views/forms.py
web/views/magicsearch.py
web/views/reledit.py
web/views/urlpublishing.py
web/views/urlrewrite.py
# HG changeset patch
# User Nicolas Chauvat <nicolas.chauvat@logilab.fr>
# Date 1363089005 -3600
# Tue Mar 12 12:50:05 2013 +0100
# Node ID f5027f8d247899142c55cf704f5726226064343b
# Parent c0d4244e5abc49637ae23cb3caace5afabc3d3ac
drop typed_eid() in favour of int() (closes #2742462)

typed_eid was introduced to abstract the eid type when running on Google AppEngine.
It is not used anymore and can be removed. Let's use int() instead.

diff --git a/__init__.py b/__init__.py
@@ -36,14 +36,14 @@
1  CW_SOFTWARE_ROOT = __path__[0]
2 
3  import sys, os, logging
4  from StringIO import StringIO
5 
6 +from logilab.common.deprecation import deprecated
7  from logilab.common.logging_ext import set_log_methods
8  from yams.constraints import BASE_CONVERTERS
9 
10 -
11  if os.environ.get('APYCOT_ROOT'):
12      logging.basicConfig(level=logging.CRITICAL)
13  else:
14      logging.basicConfig()
15 
@@ -55,12 +55,13 @@
16  # make all exceptions accessible from the package
17  from cubicweb._exceptions import *
18  from logilab.common.registry import ObjectNotFound, NoSelectableObject, RegistryNotFound
19 
20  # convert eid to the right type, raise ValueError if it's not a valid eid
21 -typed_eid = int
22 -
23 +@deprecated('[3.17] typed_eid() was removed. replace it with int() when needed.')
24 +def typed_eid(eid):
25 +    return int(eid)
26 
27  #def log_thread(f, w, a):
28  #    print f.f_code.co_filename, f.f_code.co_name
29  #import threading
30  #threading.settrace(log_thread)
diff --git a/entities/__init__.py b/entities/__init__.py
@@ -22,11 +22,11 @@
31  from warnings import warn
32 
33  from logilab.common.deprecation import deprecated
34  from logilab.common.decorators import cached
35 
36 -from cubicweb import Unauthorized, typed_eid
37 +from cubicweb import Unauthorized
38  from cubicweb.entity import Entity
39 
40 
41  class AnyEntity(Entity):
42      """an entity instance has e_schema automagically set on the class and
diff --git a/entity.py b/entity.py
@@ -31,11 +31,11 @@
43  from rql.utils import rqlvar_maker
44  from rql.stmts import Select
45  from rql.nodes import (Not, VariableRef, Constant, make_relation,
46                         Relation as RqlRelation)
47 
48 -from cubicweb import Unauthorized, typed_eid, neg_role
49 +from cubicweb import Unauthorized, neg_role
50  from cubicweb.utils import support_args
51  from cubicweb.rset import ResultSet
52  from cubicweb.appobject import AppObject
53  from cubicweb.req import _check_cw_unsafe
54  from cubicweb.schema import (RQLVocabularyConstraint, RQLConstraint,
@@ -625,11 +625,11 @@
55      def has_eid(self): # XXX cw_has_eid
56          """return True if the entity has an attributed eid (False
57          meaning that the entity has to be created
58          """
59          try:
60 -            typed_eid(self.eid)
61 +            int(self.eid)
62              return True
63          except (ValueError, TypeError):
64              return False
65 
66      def cw_is_saved(self):
diff --git a/req.py b/req.py
@@ -27,11 +27,11 @@
67 
68  from logilab.common.decorators import cached
69  from logilab.common.deprecation import deprecated
70  from logilab.common.date import ustrftime, strptime, todate, todatetime
71 
72 -from cubicweb import Unauthorized, NoSelectableObject, typed_eid, uilib
73 +from cubicweb import Unauthorized, NoSelectableObject, uilib
74  from cubicweb.rset import ResultSet
75 
76  ONESECOND = timedelta(0, 1, 0)
77  CACHE_REGISTRY = {}
78 
@@ -112,11 +112,11 @@
79      def eid_rset(self, eid, etype=None):
80          """return a result set for the given eid without doing actual query
81          (we have the eid, we can suppose it exists and user has access to the
82          entity)
83          """
84 -        eid = typed_eid(eid)
85 +        eid = int(eid)
86          if etype is None:
87              etype = self.describe(eid)[0]
88          rset = ResultSet([(eid,)], 'Any X WHERE X eid %(x)s', {'x': eid},
89                           [(etype,)])
90          rset.req = self
diff --git a/rqlrewrite.py b/rqlrewrite.py
@@ -28,11 +28,11 @@
91  from yams import BadSchemaDefinition
92 
93  from logilab.common import tempattr
94  from logilab.common.graph import has_path
95 
96 -from cubicweb import Unauthorized, typed_eid
97 +from cubicweb import Unauthorized
98 
99 
100  def add_types_restriction(schema, rqlst, newroot=None, solutions=None):
101      if newroot is None:
102          assert solutions is None
@@ -218,11 +218,11 @@
103              assert snippetvar in 'SOX'
104              self.revvarmap[snippetvar] = (selectvar, i)
105              vi = {}
106              self.varinfos.append(vi)
107              try:
108 -                vi['const'] = typed_eid(selectvar)
109 +                vi['const'] = int(selectvar)
110                  vi['rhs_rels'] = vi['lhs_rels'] = {}
111              except ValueError:
112                  try:
113                      vi['stinfo'] = sti = self.select.defined_vars[selectvar].stinfo
114                  except KeyError:
diff --git a/server/querier.py b/server/querier.py
@@ -29,11 +29,11 @@
115  from rql.nodes import (Relation, VariableRef, Constant, SubQuery, Function,
116                         Exists, Not)
117  from yams import BASE_TYPES
118 
119  from cubicweb import ValidationError, Unauthorized, QueryError, UnknownEid
120 -from cubicweb import Binary, server, typed_eid
121 +from cubicweb import Binary, server
122  from cubicweb.rset import ResultSet
123 
124  from cubicweb.utils import QueryCache, RepeatList
125  from cubicweb.server.utils import cleanup_solutions
126  from cubicweb.server.rqlannotation import SQLGenAnnotator, set_qdata
@@ -389,11 +389,11 @@
127          varkwargs = {}
128          if not session.transaction_data.get('security-rqlst-cache'):
129              for var in rqlst.defined_vars.itervalues():
130                  if var.stinfo['constnode'] is not None:
131                      eid = var.stinfo['constnode'].eval(self.args)
132 -                    varkwargs[var.name] = typed_eid(eid)
133 +                    varkwargs[var.name] = int(eid)
134          # dictionary of variables restricted for security reason
135          localchecks = {}
136          restricted_vars = set()
137          newsolutions = []
138          for solution in rqlst.solutions:
@@ -561,15 +561,15 @@
139          edited_entities = {}
140          relations = {}
141          for subj, rtype, obj in self.relation_defs():
142              # if a string is given into args instead of an int, we get it here
143              if isinstance(subj, basestring):
144 -                subj = typed_eid(subj)
145 +                subj = int(subj)
146              elif not isinstance(subj, (int, long)):
147                  subj = subj.entity.eid
148              if isinstance(obj, basestring):
149 -                obj = typed_eid(obj)
150 +                obj = int(obj)
151              elif not isinstance(obj, (int, long)):
152                  obj = obj.entity.eid
153              if repo.schema.rschema(rtype).inlined:
154                  if subj not in edited_entities:
155                      entity = session.entity_from_eid(subj)
diff --git a/server/repository.py b/server/repository.py
@@ -48,11 +48,11 @@
156 
157  from cubicweb import (CW_SOFTWARE_ROOT, CW_MIGRATION_MAP, QueryError,
158                        UnknownEid, AuthenticationError, ExecutionError,
159                        ETypeNotSupportedBySources, MultiSourcesError,
160                        BadConnectionId, Unauthorized, ValidationError,
161 -                      RepositoryError, UniqueTogetherError, typed_eid, onevent)
162 +                      RepositoryError, UniqueTogetherError, onevent)
163  from cubicweb import cwvreg, schema, server
164  from cubicweb.server import ShuttingDown, utils, hook, pool, querier, sources
165  from cubicweb.server.session import Session, InternalSession, InternalManager
166  from cubicweb.server.ssplanner import EditedEntity
167 
@@ -1016,11 +1016,11 @@
168      def type_and_source_from_eid(self, eid, session=None):
169          """return a tuple `(type, physical source uri, extid, actual source
170          uri)` for the entity of the given `eid`
171          """
172          try:
173 -            eid = typed_eid(eid)
174 +            eid = int(eid)
175          except ValueError:
176              raise UnknownEid(eid)
177          try:
178              return self._type_source_cache[eid]
179          except KeyError:
@@ -1044,11 +1044,11 @@
180          etcache = self._type_source_cache
181          extidcache = self._extid_cache
182          rqlcache = self.querier._rql_cache
183          for eid in eids:
184              try:
185 -                etype, uri, extid, auri = etcache.pop(typed_eid(eid)) # may be a string in some cases
186 +                etype, uri, extid, auri = etcache.pop(int(eid)) # may be a string in some cases
187                  rqlcache.pop( ('%s X WHERE X eid %s' % (etype, eid),), None)
188                  extidcache.pop((extid, uri), None)
189              except KeyError:
190                  etype = None
191              rqlcache.pop( ('Any X WHERE X eid %s' % eid,), None)
@@ -1073,11 +1073,11 @@
192              except TypeError:
193                  raise QueryError('bad cache key %s (value: %r)' % (
194                      key, args[key]))
195              cachekey.append(etype)
196              # ensure eid is correctly typed in args
197 -            args[key] = typed_eid(args[key])
198 +            args[key] = int(args[key])
199          return tuple(cachekey)
200 
201      def eid2extid(self, source, eid, session=None):
202          """get local id from an eid"""
203          etype, uri, extid, _ = self.type_and_source_from_eid(eid, session)
diff --git a/server/schemaserial.py b/server/schemaserial.py
@@ -24,11 +24,11 @@
204 
205  from logilab.common.shellutils import ProgressBar
206 
207  from yams import BadSchemaDefinition, schema as schemamod, buildobjs as ybo
208 
209 -from cubicweb import CW_SOFTWARE_ROOT, typed_eid
210 +from cubicweb import CW_SOFTWARE_ROOT
211  from cubicweb.schema import (CONSTRAINTS, ETYPE_NAME_MAP,
212                               VIRTUAL_RTYPES, PURE_VIRTUAL_RTYPES)
213  from cubicweb.server import sqlutils
214 
215  def group_mapping(cursor, interactive=True):
@@ -56,11 +56,11 @@
216              while True:
217                  value = raw_input('eid for group %s: ' % group).strip()
218                  if not value:
219                      continue
220                  try:
221 -                    eid = typed_eid(value)
222 +                    eid = int(value)
223                  except ValueError:
224                      print 'eid should be an integer'
225                      continue
226                  for eid_ in res.values():
227                      if eid == eid_:
diff --git a/server/ssplanner.py b/server/ssplanner.py
@@ -20,11 +20,11 @@
228  __docformat__ = "restructuredtext en"
229 
230  from rql.stmts import Union, Select
231  from rql.nodes import Constant, Relation
232 
233 -from cubicweb import QueryError, typed_eid
234 +from cubicweb import QueryError
235  from cubicweb.schema import VIRTUAL_RTYPES
236  from cubicweb.rqlrewrite import add_types_restriction
237  from cubicweb.server.edition import EditedEntity
238 
239  READ_ONLY_RTYPES = set(('eid', 'has_text', 'is', 'is_instance_of', 'identity'))
@@ -77,11 +77,11 @@
240      eschema = session.vreg.schema.eschema
241      for rel in rqlst.where.get_nodes(Relation):
242          if rel.r_type == 'eid' and not rel.neged(strict=True):
243              lhs, rhs = rel.get_variable_parts()
244              if isinstance(rhs, Constant):
245 -                eid = typed_eid(rhs.eval(plan.args))
246 +                eid = int(rhs.eval(plan.args))
247                  # check read permission here since it may not be done by
248                  # the generated select substep if not emited (eg nothing
249                  # to be selected)
250                  if checkread and eid not in neweids:
251                      with session.security_enabled(read=False):
@@ -514,11 +514,11 @@
252 
253      def execute(self):
254          """execute this step"""
255          results = self.execute_child()
256          if results:
257 -            todelete = frozenset(typed_eid(eid) for eid, in results)
258 +            todelete = frozenset(int(eid) for eid, in results)
259              session = self.plan.session
260              session.repo.glob_delete_entities(session, todelete)
261          return results
262 
263  class DeleteRelationsStep(Step):
@@ -560,11 +560,11 @@
264              newrow = []
265              for (lhsinfo, rhsinfo, rschema) in self.updatedefs:
266                  lhsval = _handle_relterm(lhsinfo, row, newrow)
267                  rhsval = _handle_relterm(rhsinfo, row, newrow)
268                  if rschema.final or rschema.inlined:
269 -                    eid = typed_eid(lhsval)
270 +                    eid = int(lhsval)
271                      try:
272                          edited = edefs[eid]
273                      except KeyError:
274                          edef = session.entity_from_eid(eid)
275                          edefs[eid] = edited = EditedEntity(edef)
diff --git a/sobjects/cwxmlparser.py b/sobjects/cwxmlparser.py
@@ -40,11 +40,11 @@
276  from logilab.common.decorators import classproperty
277 
278  from yams.constraints import BASE_CONVERTERS
279  from yams.schema import role_name as rn
280 
281 -from cubicweb import ValidationError, RegistryException, typed_eid
282 +from cubicweb import ValidationError, RegistryException
283  from cubicweb.view import Component
284  from cubicweb.server.sources import datafeed
285  from cubicweb.server.hook import match_rtype
286 
287  # XXX see cubicweb.cwvreg.YAMS_TO_PY
@@ -324,14 +324,14 @@
288          node = self.node
289          item = dict(node.attrib.items())
290          item['cwtype'] = unicode(node.tag)
291          item.setdefault('cwsource', None)
292          try:
293 -            item['eid'] = typed_eid(item['eid'])
294 +            item['eid'] = int(item['eid'])
295          except KeyError:
296              # cw < 3.11 compat mode XXX
297 -            item['eid'] = typed_eid(node.find('eid').text)
298 +            item['eid'] = int(node.find('eid').text)
299              item['cwuri'] = node.find('cwuri').text
300          rels = {}
301          for child in node:
302              role = child.get('role')
303              if role:
diff --git a/sobjects/textparsers.py b/sobjects/textparsers.py
@@ -24,11 +24,11 @@
304 
305  __docformat__ = "restructuredtext en"
306 
307  import re
308 
309 -from cubicweb import UnknownEid, typed_eid
310 +from cubicweb import UnknownEid
311  from cubicweb.view import Component
312 
313 
314  class TextAnalyzer(Component):
315      """analyze and extract information from plain text by calling registered
@@ -64,11 +64,11 @@
316      instr_rgx = re.compile(':(\w+):\s*#?(\d+)', re.U)
317 
318      def parse(self, caller, text):
319          for trname, eid in self.instr_rgx.findall(text):
320              try:
321 -                entity = self._cw.entity_from_eid(typed_eid(eid))
322 +                entity = self._cw.entity_from_eid(int(eid))
323              except UnknownEid:
324                  self.error("can't get entity with eid %s", eid)
325                  continue
326              if not hasattr(entity, 'in_state'):
327                  self.error('bad change state instruction for eid %s', eid)
diff --git a/web/facet.py b/web/facet.py
@@ -62,11 +62,11 @@
328  from logilab.common.deprecation import deprecated
329  from logilab.common.registry import yes
330 
331  from rql import nodes, utils
332 
333 -from cubicweb import Unauthorized, typed_eid
334 +from cubicweb import Unauthorized
335  from cubicweb.schema import display_name
336  from cubicweb.uilib import css_em_num_value
337  from cubicweb.utils import make_uid
338  from cubicweb.predicates import match_context_prop, partial_relation_possible
339  from cubicweb.appobject import AppObject
@@ -498,12 +498,11 @@
340      @property
341      def wdgclass(self):
342          return FacetVocabularyWidget
343 
344      def get_selected(self):
345 -        return frozenset(typed_eid(eid)
346 -                         for eid in self._cw.list_form_param(self.__regid__))
347 +        return frozenset(int(eid) for eid in self._cw.list_form_param(self.__regid__))
348 
349      def get_widget(self):
350          """Return the widget instance to use to display this facet.
351 
352          This implementation expects a .vocabulary method on the facet and
diff --git a/web/views/autoform.py b/web/views/autoform.py
@@ -125,11 +125,11 @@
353 
354  from logilab.mtconverter import xml_escape
355  from logilab.common.decorators import iclassmethod, cached
356  from logilab.common.deprecation import deprecated
357 
358 -from cubicweb import typed_eid, neg_role, uilib
359 +from cubicweb import neg_role, uilib
360  from cubicweb.schema import display_name
361  from cubicweb.view import EntityView
362  from cubicweb.predicates import (
363      match_kwargs, match_form_params, non_final_entity,
364      specified_etype_implements)
@@ -413,11 +413,11 @@
365      """
366      for rstr in rdescr:
367          subjs, rtype, objs = rstr.split(':')
368          for subj in subjs.split('_'):
369              for obj in objs.split('_'):
370 -                yield typed_eid(subj), rtype, typed_eid(obj)
371 +                yield int(subj), rtype, int(obj)
372 
373  def delete_relations(req, rdefs):
374      """delete relations from the repository"""
375      # FIXME convert to using the syntax subject:relation:eids
376      execute = req.execute
@@ -458,16 +458,16 @@
377 
378 
379  def _add_pending(req, eidfrom, rel, eidto, kind):
380      key = 'pending_%s' % kind
381      pendings = req.session.data.setdefault(key, set())
382 -    pendings.add( (typed_eid(eidfrom), rel, typed_eid(eidto)) )
383 +    pendings.add( (int(eidfrom), rel, int(eidto)) )
384 
385  def _remove_pending(req, eidfrom, rel, eidto, kind):
386      key = 'pending_%s' % kind
387      pendings = req.session.data[key]
388 -    pendings.remove( (typed_eid(eidfrom), rel, typed_eid(eidto)) )
389 +    pendings.remove( (int(eidfrom), rel, int(eidto)) )
390 
391  @ajaxfunc(output_type='json')
392  def remove_pending_insert(self, (eidfrom, rel, eidto)):
393      _remove_pending(self._cw, eidfrom, rel, eidto, 'insert')
394 
@@ -604,11 +604,11 @@
395          entity = form.edited_entity
396          pending_inserts = set(get_pending_inserts(form._cw, form.edited_entity.eid))
397          for pendingid in pending_inserts:
398              eidfrom, rtype, eidto = pendingid.split(':')
399              pendingid = 'id' + pendingid
400 -            if typed_eid(eidfrom) == entity.eid: # subject
401 +            if int(eidfrom) == entity.eid: # subject
402                  label = display_name(form._cw, rtype, 'subject',
403                                       entity.__regid__)
404                  reid = eidto
405              else:
406                  label = display_name(form._cw, rtype, 'object',
diff --git a/web/views/basecontrollers.py b/web/views/basecontrollers.py
@@ -25,11 +25,11 @@
407  from warnings import warn
408 
409  from logilab.common.deprecation import deprecated
410 
411  from cubicweb import (NoSelectableObject, ObjectNotFound, ValidationError,
412 -                      AuthenticationError, typed_eid, UndoTransactionException,
413 +                      AuthenticationError, UndoTransactionException,
414                        Forbidden)
415  from cubicweb.utils import json_dumps
416  from cubicweb.predicates import (authenticated_user, anonymous_user,
417                                  match_form_params)
418  from cubicweb.web import Redirect, RemoteCallFailed
@@ -174,21 +174,21 @@
419          """
420          req = self._cw
421          if not '__linkto' in req.form:
422              return
423          if eid is None:
424 -            eid = typed_eid(req.form['eid'])
425 +            eid = int(req.form['eid'])
426          for linkto in req.list_form_param('__linkto', pop=True):
427              rtype, eids, target = linkto.split(':')
428              assert target in ('subject', 'object')
429              eids = eids.split('_')
430              if target == 'subject':
431                  rql = 'SET X %s Y WHERE X eid %%(x)s, Y eid %%(y)s' % rtype
432              else:
433                  rql = 'SET Y %s X WHERE X eid %%(x)s, Y eid %%(y)s' % rtype
434              for teid in eids:
435 -                req.execute(rql, {'x': eid, 'y': typed_eid(teid)})
436 +                req.execute(rql, {'x': eid, 'y': int(teid)})
437 
438 
439  def _validation_error(req, ex):
440      req.cnx.rollback()
441      ex.translate(req._) # translate messages using ui language
diff --git a/web/views/bookmark.py b/web/views/bookmark.py
@@ -20,11 +20,11 @@
442  __docformat__ = "restructuredtext en"
443  _ = unicode
444 
445  from logilab.mtconverter import xml_escape
446 
447 -from cubicweb import Unauthorized, typed_eid
448 +from cubicweb import Unauthorized
449  from cubicweb.predicates import is_instance, one_line_rset
450  from cubicweb.web import action, component, htmlwidgets, formwidgets as fw
451  from cubicweb.web.views import uicfg, primary
452  from cubicweb.web.views.ajaxcontroller import ajaxfunc
453 
@@ -135,6 +135,6 @@
454          self.render_items(w)
455 
456  @ajaxfunc
457  def delete_bookmark(self, beid):
458      rql = 'DELETE B bookmarked_by U WHERE B eid %(b)s, U eid %(u)s'
459 -    self._cw.execute(rql, {'b': typed_eid(beid), 'u' : self._cw.user.eid})
460 +    self._cw.execute(rql, {'b': int(beid), 'u' : self._cw.user.eid})
diff --git a/web/views/editcontroller.py b/web/views/editcontroller.py
@@ -23,11 +23,11 @@
461 
462  from logilab.common.deprecation import deprecated
463 
464  from rql.utils import rqlvar_maker
465 
466 -from cubicweb import Binary, ValidationError, typed_eid
467 +from cubicweb import Binary, ValidationError
468  from cubicweb.view import EntityAdapter, implements_adapter_compat
469  from cubicweb.predicates import is_instance
470  from cubicweb.web import (INTERNAL_FIELD_VALUE, RequestError, NothingToEdit,
471                            ProcessFormError)
472  from cubicweb.web.views import basecontrollers, autoform
@@ -65,11 +65,11 @@
473          pass
474 
475 
476  def valerror_eid(eid):
477      try:
478 -        return typed_eid(eid)
479 +        return int(eid)
480      except (ValueError, TypeError):
481          return eid
482 
483  class RqlQuery(object):
484      def __init__(self):
@@ -215,11 +215,11 @@
485          if '__delete' in formparams:
486              # XXX deprecate?
487              todelete = self._cw.list_form_param('__delete', formparams, pop=True)
488              autoform.delete_relations(self._cw, todelete)
489          if '__cloned_eid' in formparams:
490 -            entity.copy_relations(typed_eid(formparams['__cloned_eid']))
491 +            entity.copy_relations(int(formparams['__cloned_eid']))
492          if is_main_entity: # only execute linkto for the main entity
493              self.execute_linkto(entity.eid)
494          return eid
495 
496      def handle_formfield(self, form, field, rqlquery=None):
diff --git a/web/views/editviews.py b/web/views/editviews.py
@@ -21,11 +21,10 @@
497  _ = unicode
498 
499  from logilab.common.decorators import cached
500  from logilab.mtconverter import xml_escape
501 
502 -from cubicweb import typed_eid
503  from cubicweb.view import EntityView, StartupView
504  from cubicweb.predicates import (one_line_rset, non_final_entity,
505                                   match_search_state)
506  from cubicweb.web import httpcache
507  from cubicweb.web.views import baseviews, linksearch_select_url
@@ -51,11 +50,11 @@
508 
509      @cached
510      def filter_box_context_info(self):
511          entity = self.cw_rset.get_entity(0, 0)
512          role, eid, rtype, etype = self._cw.search_state[1]
513 -        assert entity.eid == typed_eid(eid)
514 +        assert entity.eid == int(eid)
515          # the default behaviour is to fetch all unrelated entities and display
516          # them. Use fetch_order and not fetch_unrelated_order as sort method
517          # since the latter is mainly there to select relevant items in the combo
518          # box, it doesn't give interesting result in this context
519          rql, args = entity.cw_unrelated_rql(rtype, etype, role,
diff --git a/web/views/forms.py b/web/views/forms.py
@@ -49,11 +49,11 @@
520  from logilab.common.decorators import iclassmethod, cached
521  from logilab.common.compat import any
522  from logilab.common.textutils import splitstrip
523  from logilab.common.deprecation import deprecated
524 
525 -from cubicweb import ValidationError, typed_eid
526 +from cubicweb import ValidationError
527  from cubicweb.utils import support_args
528  from cubicweb.predicates import non_final_entity, match_kwargs, one_line_rset
529  from cubicweb.web import RequestError, ProcessFormError
530  from cubicweb.web import form, formwidgets as fwdgs
531  from cubicweb.web.views import uicfg
@@ -402,11 +402,11 @@
532          except form.FieldNotFound:
533              return {}
534          linked_to = {}
535          for linkto in self._cw.list_form_param('__linkto'):
536              ltrtype, eid, ltrole = linkto.split(':')
537 -            linked_to.setdefault((ltrtype, ltrole), []).append(typed_eid(eid))
538 +            linked_to.setdefault((ltrtype, ltrole), []).append(int(eid))
539          return linked_to
540 
541      def session_key(self):
542          """return the key that may be used to store / retreive data about a
543          previous post which failed because of a validation error
@@ -434,11 +434,11 @@
544      def actual_eid(self, eid):
545          # should be either an int (existant entity) or a variable (to be
546          # created entity)
547          assert eid or eid == 0, repr(eid) # 0 is a valid eid
548          try:
549 -            return typed_eid(eid)
550 +            return int(eid)
551          except ValueError:
552              try:
553                  return self._cw.data['eidmap'][eid]
554              except KeyError:
555                  self._cw.data['eidmap'][eid] = None
diff --git a/web/views/magicsearch.py b/web/views/magicsearch.py
@@ -27,11 +27,11 @@
556 
557  from rql import RQLSyntaxError, BadRQLQuery, parse
558  from rql.utils import rqlvar_maker
559  from rql.nodes import Relation
560 
561 -from cubicweb import Unauthorized, typed_eid
562 +from cubicweb import Unauthorized
563  from cubicweb.view import Component
564  from cubicweb.web.views.ajaxcontroller import ajaxfunc
565 
566  LOGGER = getLogger('cubicweb.magicsearch')
567 
@@ -252,11 +252,11 @@
568      def _one_word_query(self, word):
569          """Specific process for one word query (case (1) of preprocess_rql)
570          """
571          # if this is an integer, then directly go to eid
572          try:
573 -            eid = typed_eid(word)
574 +            eid = int(word)
575              return 'Any X WHERE X eid %(x)s', {'x': eid}, 'x'
576          except ValueError:
577              etype = self._get_entity_type(word)
578              return '%s %s' % (etype, etype[0]),
579 
diff --git a/web/views/reledit.py b/web/views/reledit.py
@@ -27,11 +27,11 @@
580 
581  from logilab.mtconverter import xml_escape
582  from logilab.common.deprecation import deprecated, class_renamed
583  from logilab.common.decorators import cached
584 
585 -from cubicweb import neg_role, typed_eid
586 +from cubicweb import neg_role
587  from cubicweb.schema import display_name
588  from cubicweb.utils import json, json_dumps
589  from cubicweb.predicates import non_final_entity, match_kwargs
590  from cubicweb.view import EntityView
591  from cubicweb.web import stdmsgs
@@ -400,11 +400,11 @@
592  @ajaxfunc(output_type='xhtml')
593  def reledit_form(self):
594      req = self._cw
595      args = dict((x, req.form[x])
596                  for x in ('formid', 'rtype', 'role', 'reload', 'action'))
597 -    rset = req.eid_rset(typed_eid(self._cw.form['eid']))
598 +    rset = req.eid_rset(int(self._cw.form['eid']))
599      try:
600          args['reload'] = json.loads(args['reload'])
601      except ValueError: # not true/false, an absolute url
602          assert args['reload'].startswith('http')
603      view = req.vreg['views'].select('reledit', req, rset=rset, rtype=args['rtype'])
diff --git a/web/views/urlpublishing.py b/web/views/urlpublishing.py
@@ -57,11 +57,11 @@
604  """
605  __docformat__ = "restructuredtext en"
606 
607  from rql import TypeResolverException
608 
609 -from cubicweb import RegistryException, typed_eid
610 +from cubicweb import RegistryException
611  from cubicweb.web import NotFound, Redirect, component
612 
613 
614  class PathDontMatch(Exception):
615      """exception used by url evaluators to notify they can't evaluate
@@ -163,11 +163,11 @@
616      priority = 1
617      def evaluate_path(self, req, parts):
618          if len(parts) != 1:
619              raise PathDontMatch()
620          try:
621 -            rset = req.execute('Any X WHERE X eid %(x)s', {'x': typed_eid(parts[0])})
622 +            rset = req.execute('Any X WHERE X eid %(x)s', {'x': int(parts[0])})
623          except ValueError:
624              raise PathDontMatch()
625          if rset.rowcount == 0:
626              raise NotFound()
627          return None, rset
@@ -220,11 +220,11 @@
628          st = cls.fetch_rqlst(req.user, ordermethod=None)
629          st.add_constant_restriction(st.get_variable('X'), attrname,
630                                      'x', 'Substitute')
631          if attrname == 'eid':
632              try:
633 -                rset = req.execute(st.as_string(), {'x': typed_eid(value)})
634 +                rset = req.execute(st.as_string(), {'x': int(value)})
635              except (ValueError, TypeResolverException):
636                  # conflicting eid/type
637                  raise PathDontMatch()
638          else:
639              rset = req.execute(st.as_string(), {'x': value})
diff --git a/web/views/urlrewrite.py b/web/views/urlrewrite.py
@@ -17,11 +17,10 @@
640  # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
641  """Rules based url rewriter component, to get configurable RESTful urls"""
642 
643  import re
644 
645 -from cubicweb import typed_eid
646  from cubicweb.uilib import domid
647  from cubicweb.appobject import AppObject
648 
649 
650  def rgx(pattern, flags=0):
@@ -184,11 +183,11 @@
651                      try:
652                          kwargs[key] = transforms[key](value)
653                      except KeyError:
654                          kwargs[key] = value
655                      if cachekey is not None and key in cachekey:
656 -                        kwargs[key] = typed_eid(value)
657 +                        kwargs[key] = int(value)
658              if setuser:
659                  kwargs['u'] = req.user.eid
660              for param in rqlformparams:
661                  kwargs.setdefault(param, req.form.get(param))
662              rset = req.execute(rql, kwargs, cachekey)