merge 3.16 fix in default
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Thu, 21 Mar 2013 19:08:07 +0100
changeset 8759 cd68cd879def
parent 8752 e19f4bba89cd (diff)
parent 8758 3a0d91237e2c (current diff)
child 8760 17994bf95d6a
merge 3.16 fix in default
--- a/__init__.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/__init__.py	Thu Mar 21 19:08:07 2013 +0100
@@ -38,10 +38,10 @@
 import sys, os, logging
 from StringIO import StringIO
 
+from logilab.common.deprecation import deprecated
 from logilab.common.logging_ext import set_log_methods
 from yams.constraints import BASE_CONVERTERS
 
-
 if os.environ.get('APYCOT_ROOT'):
     logging.basicConfig(level=logging.CRITICAL)
 else:
@@ -57,8 +57,9 @@
 from logilab.common.registry import ObjectNotFound, NoSelectableObject, RegistryNotFound
 
 # convert eid to the right type, raise ValueError if it's not a valid eid
-typed_eid = int
-
+@deprecated('[3.17] typed_eid() was removed. replace it with int() when needed.')
+def typed_eid(eid):
+    return int(eid)
 
 #def log_thread(f, w, a):
 #    print f.f_code.co_filename, f.f_code.co_name
--- a/__pkginfo__.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/__pkginfo__.py	Thu Mar 21 19:08:07 2013 +0100
@@ -43,7 +43,7 @@
     'logilab-common': '>= 0.59.0',
     'logilab-mtconverter': '>= 0.8.0',
     'rql': '>= 0.31.2',
-    'yams': '>= 0.36.0',
+    'yams': '>= 0.37.0',
     #gettext                    # for xgettext, msgcat, etc...
     # web dependancies
     'simplejson': '>= 2.0.9',
--- a/debian/control	Thu Mar 21 16:52:13 2013 +0100
+++ b/debian/control	Thu Mar 21 19:08:07 2013 +0100
@@ -16,7 +16,7 @@
  python-unittest2,
  python-logilab-mtconverter,
  python-rql,
- python-yams,
+ python-yams (>= 0.37),
  python-lxml,
 Standards-Version: 3.9.1
 Homepage: http://www.cubicweb.org
--- a/entities/__init__.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/entities/__init__.py	Thu Mar 21 19:08:07 2013 +0100
@@ -24,7 +24,7 @@
 from logilab.common.deprecation import deprecated
 from logilab.common.decorators import cached
 
-from cubicweb import Unauthorized, typed_eid
+from cubicweb import Unauthorized
 from cubicweb.entity import Entity
 
 
--- a/entity.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/entity.py	Thu Mar 21 19:08:07 2013 +0100
@@ -33,7 +33,7 @@
 from rql.nodes import (Not, VariableRef, Constant, make_relation,
                        Relation as RqlRelation)
 
-from cubicweb import Unauthorized, typed_eid, neg_role
+from cubicweb import Unauthorized, neg_role
 from cubicweb.utils import support_args
 from cubicweb.rset import ResultSet
 from cubicweb.appobject import AppObject
@@ -627,7 +627,7 @@
         meaning that the entity has to be created
         """
         try:
-            typed_eid(self.eid)
+            int(self.eid)
             return True
         except (ValueError, TypeError):
             return False
--- a/etwist/request.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/etwist/request.py	Thu Mar 21 19:08:07 2013 +0100
@@ -39,6 +39,7 @@
                 self.form[key] = (name, stream)
             else:
                 self.form[key] = (unicode(name, self.encoding), stream)
+        self.content = self._twreq.content # stream
 
     def http_method(self):
         """returns 'POST', 'GET', 'HEAD', etc."""
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/etwist/test/data/views.py	Thu Mar 21 19:08:07 2013 +0100
@@ -0,0 +1,29 @@
+# copyright 2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
+#
+# This file is part of CubicWeb.
+#
+# CubicWeb is free software: you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation, either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# CubicWeb is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License along
+# with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
+"""only for unit tests !"""
+
+from cubicweb.view import View
+from cubicweb.predicates import match_http_method
+
+class PutView(View):
+    __regid__ = 'put'
+    __select__ = match_http_method('PUT')
+    binary = True
+
+    def call(self):
+        self.w(self._cw.content.read())
--- a/etwist/test/unittest_server.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/etwist/test/unittest_server.py	Thu Mar 21 19:08:07 2013 +0100
@@ -19,6 +19,7 @@
 import os, os.path as osp, glob
 
 from cubicweb.devtools.testlib import CubicWebTC
+from cubicweb.devtools.httptest import CubicWebServerTC
 from cubicweb.etwist.server import host_prefixed_baseurl
 
 
@@ -53,6 +54,13 @@
         self._check('http://localhost:8080/hg/', 'code.cubicweb.org',
                     'http://localhost:8080/hg/')
 
+
+class ETwistHTTPTC(CubicWebServerTC):
+    def test_put_content(self):
+        body = 'hop'
+        response = self.web_request('?vid=put', method='PUT', body=body)
+        self.assertEqual(body, response.body)
+
 if __name__ == '__main__':
     from logilab.common.testlib import unittest_main
     unittest_main()
--- a/predicates.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/predicates.py	Thu Mar 21 19:08:07 2013 +0100
@@ -1470,6 +1470,15 @@
         return frozenset(req.form)
 
 
+class match_http_method(ExpectedValuePredicate):
+    """Return non-zero score if one of the HTTP methods specified as
+    initializer arguments is the HTTP method of the request (GET, POST, ...).
+    """
+
+    def __call__(self, cls, req, **kwargs):
+        return int(req.http_method() in self.expected)
+
+
 class match_edited_type(ExpectedValuePredicate):
     """return non-zero if main edited entity type is the one specified as
     initializer argument, or is among initializer arguments if `mode` == 'any'.
--- a/req.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/req.py	Thu Mar 21 19:08:07 2013 +0100
@@ -29,7 +29,7 @@
 from logilab.common.deprecation import deprecated
 from logilab.common.date import ustrftime, strptime, todate, todatetime
 
-from cubicweb import Unauthorized, NoSelectableObject, typed_eid, uilib
+from cubicweb import Unauthorized, NoSelectableObject, uilib
 from cubicweb.rset import ResultSet
 
 ONESECOND = timedelta(0, 1, 0)
@@ -114,7 +114,7 @@
         (we have the eid, we can suppose it exists and user has access to the
         entity)
         """
-        eid = typed_eid(eid)
+        eid = int(eid)
         if etype is None:
             etype = self.describe(eid)[0]
         rset = ResultSet([(eid,)], 'Any X WHERE X eid %(x)s', {'x': eid},
--- a/rqlrewrite.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/rqlrewrite.py	Thu Mar 21 19:08:07 2013 +0100
@@ -30,7 +30,7 @@
 from logilab.common import tempattr
 from logilab.common.graph import has_path
 
-from cubicweb import Unauthorized, typed_eid
+from cubicweb import Unauthorized
 
 
 def add_types_restriction(schema, rqlst, newroot=None, solutions=None):
@@ -220,7 +220,7 @@
             vi = {}
             self.varinfos.append(vi)
             try:
-                vi['const'] = typed_eid(selectvar)
+                vi['const'] = int(selectvar)
                 vi['rhs_rels'] = vi['lhs_rels'] = {}
             except ValueError:
                 try:
--- a/server/querier.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/server/querier.py	Thu Mar 21 19:08:07 2013 +0100
@@ -31,7 +31,7 @@
 from yams import BASE_TYPES
 
 from cubicweb import ValidationError, Unauthorized, QueryError, UnknownEid
-from cubicweb import Binary, server, typed_eid
+from cubicweb import Binary, server
 from cubicweb.rset import ResultSet
 
 from cubicweb.utils import QueryCache, RepeatList
@@ -391,7 +391,7 @@
             for var in rqlst.defined_vars.itervalues():
                 if var.stinfo['constnode'] is not None:
                     eid = var.stinfo['constnode'].eval(self.args)
-                    varkwargs[var.name] = typed_eid(eid)
+                    varkwargs[var.name] = int(eid)
         # dictionary of variables restricted for security reason
         localchecks = {}
         restricted_vars = set()
@@ -563,11 +563,11 @@
         for subj, rtype, obj in self.relation_defs():
             # if a string is given into args instead of an int, we get it here
             if isinstance(subj, basestring):
-                subj = typed_eid(subj)
+                subj = int(subj)
             elif not isinstance(subj, (int, long)):
                 subj = subj.entity.eid
             if isinstance(obj, basestring):
-                obj = typed_eid(obj)
+                obj = int(obj)
             elif not isinstance(obj, (int, long)):
                 obj = obj.entity.eid
             if repo.schema.rschema(rtype).inlined:
--- a/server/repository.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/server/repository.py	Thu Mar 21 19:08:07 2013 +0100
@@ -50,7 +50,7 @@
                       UnknownEid, AuthenticationError, ExecutionError,
                       ETypeNotSupportedBySources, MultiSourcesError,
                       BadConnectionId, Unauthorized, ValidationError,
-                      RepositoryError, UniqueTogetherError, typed_eid, onevent)
+                      RepositoryError, UniqueTogetherError, onevent)
 from cubicweb import cwvreg, schema, server
 from cubicweb.server import ShuttingDown, utils, hook, pool, querier, sources
 from cubicweb.server.session import Session, InternalSession, InternalManager
@@ -1018,7 +1018,7 @@
         uri)` for the entity of the given `eid`
         """
         try:
-            eid = typed_eid(eid)
+            eid = int(eid)
         except ValueError:
             raise UnknownEid(eid)
         try:
@@ -1046,7 +1046,7 @@
         rqlcache = self.querier._rql_cache
         for eid in eids:
             try:
-                etype, uri, extid, auri = etcache.pop(typed_eid(eid)) # may be a string in some cases
+                etype, uri, extid, auri = etcache.pop(int(eid)) # may be a string in some cases
                 rqlcache.pop( ('%s X WHERE X eid %s' % (etype, eid),), None)
                 extidcache.pop((extid, uri), None)
             except KeyError:
@@ -1075,7 +1075,7 @@
                     key, args[key]))
             cachekey.append(etype)
             # ensure eid is correctly typed in args
-            args[key] = typed_eid(args[key])
+            args[key] = int(args[key])
         return tuple(cachekey)
 
     def eid2extid(self, source, eid, session=None):
--- a/server/schemaserial.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/server/schemaserial.py	Thu Mar 21 19:08:07 2013 +0100
@@ -26,7 +26,7 @@
 
 from yams import BadSchemaDefinition, schema as schemamod, buildobjs as ybo
 
-from cubicweb import CW_SOFTWARE_ROOT, typed_eid
+from cubicweb import CW_SOFTWARE_ROOT
 from cubicweb.schema import (CONSTRAINTS, ETYPE_NAME_MAP,
                              VIRTUAL_RTYPES, PURE_VIRTUAL_RTYPES)
 from cubicweb.server import sqlutils
@@ -58,7 +58,7 @@
                 if not value:
                     continue
                 try:
-                    eid = typed_eid(value)
+                    eid = int(value)
                 except ValueError:
                     print 'eid should be an integer'
                     continue
--- a/server/serverctl.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/server/serverctl.py	Thu Mar 21 19:08:07 2013 +0100
@@ -39,6 +39,7 @@
 from cubicweb.server.serverconfig import (
     USER_OPTIONS, ServerConfiguration, SourceConfiguration,
     ask_source_config, generate_source_config)
+from yams.diff import schema_diff
 
 # utility functions ###########################################################
 
@@ -1065,12 +1066,31 @@
             if val:
                 print key, ':', val
 
+class SchemaDiffCommand(Command):
+    """ generate a diff between schema and fsschema description
+    <instance>
+      the name of a diff tool to compare the two generated file
+    <diff-tool>
+    """
+    name = 'schema-diff'
+    arguments = '<instance> <diff-tool>'
+    min_args = max_args = 2
+
+    def run(self, args):
+        appid = args.pop(0)
+        diff_tool = args.pop(0)
+        config = ServerConfiguration.config_for(appid)
+        repo, cnx = repo_cnx(config)
+        session = repo._get_session(cnx.sessionid, setcnxset=True)
+        fsschema = config.load_schema(expand_cubes=True)
+        schema_diff(repo.schema, fsschema, diff_tool)
+
 
 for cmdclass in (CreateInstanceDBCommand, InitInstanceCommand,
                  GrantUserOnInstanceCommand, ResetAdminPasswordCommand,
                  StartRepositoryCommand,
                  DBDumpCommand, DBRestoreCommand, DBCopyCommand,
                  AddSourceCommand, CheckRepositoryCommand, RebuildFTICommand,
-                 SynchronizeInstanceSchemaCommand, SynchronizeSourceCommand
+                 SynchronizeInstanceSchemaCommand, SynchronizeSourceCommand, SchemaDiffCommand,
                  ):
     CWCTL.register(cmdclass)
--- a/server/ssplanner.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/server/ssplanner.py	Thu Mar 21 19:08:07 2013 +0100
@@ -22,7 +22,7 @@
 from rql.stmts import Union, Select
 from rql.nodes import Constant, Relation
 
-from cubicweb import QueryError, typed_eid
+from cubicweb import QueryError
 from cubicweb.schema import VIRTUAL_RTYPES
 from cubicweb.rqlrewrite import add_types_restriction
 from cubicweb.server.edition import EditedEntity
@@ -79,7 +79,7 @@
         if rel.r_type == 'eid' and not rel.neged(strict=True):
             lhs, rhs = rel.get_variable_parts()
             if isinstance(rhs, Constant):
-                eid = typed_eid(rhs.eval(plan.args))
+                eid = int(rhs.eval(plan.args))
                 # check read permission here since it may not be done by
                 # the generated select substep if not emited (eg nothing
                 # to be selected)
@@ -516,7 +516,7 @@
         """execute this step"""
         results = self.execute_child()
         if results:
-            todelete = frozenset(typed_eid(eid) for eid, in results)
+            todelete = frozenset(int(eid) for eid, in results)
             session = self.plan.session
             session.repo.glob_delete_entities(session, todelete)
         return results
@@ -562,7 +562,7 @@
                 lhsval = _handle_relterm(lhsinfo, row, newrow)
                 rhsval = _handle_relterm(rhsinfo, row, newrow)
                 if rschema.final or rschema.inlined:
-                    eid = typed_eid(lhsval)
+                    eid = int(lhsval)
                     try:
                         edited = edefs[eid]
                     except KeyError:
--- a/sobjects/cwxmlparser.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/sobjects/cwxmlparser.py	Thu Mar 21 19:08:07 2013 +0100
@@ -42,7 +42,7 @@
 from yams.constraints import BASE_CONVERTERS
 from yams.schema import role_name as rn
 
-from cubicweb import ValidationError, RegistryException, typed_eid
+from cubicweb import ValidationError, RegistryException
 from cubicweb.view import Component
 from cubicweb.server.sources import datafeed
 from cubicweb.server.hook import match_rtype
@@ -326,10 +326,10 @@
         item['cwtype'] = unicode(node.tag)
         item.setdefault('cwsource', None)
         try:
-            item['eid'] = typed_eid(item['eid'])
+            item['eid'] = int(item['eid'])
         except KeyError:
             # cw < 3.11 compat mode XXX
-            item['eid'] = typed_eid(node.find('eid').text)
+            item['eid'] = int(node.find('eid').text)
             item['cwuri'] = node.find('cwuri').text
         rels = {}
         for child in node:
--- a/sobjects/textparsers.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/sobjects/textparsers.py	Thu Mar 21 19:08:07 2013 +0100
@@ -26,7 +26,7 @@
 
 import re
 
-from cubicweb import UnknownEid, typed_eid
+from cubicweb import UnknownEid
 from cubicweb.view import Component
 
 
@@ -66,7 +66,7 @@
     def parse(self, caller, text):
         for trname, eid in self.instr_rgx.findall(text):
             try:
-                entity = self._cw.entity_from_eid(typed_eid(eid))
+                entity = self._cw.entity_from_eid(int(eid))
             except UnknownEid:
                 self.error("can't get entity with eid %s", eid)
                 continue
--- a/web/facet.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/web/facet.py	Thu Mar 21 19:08:07 2013 +0100
@@ -64,7 +64,7 @@
 
 from rql import nodes, utils
 
-from cubicweb import Unauthorized, typed_eid
+from cubicweb import Unauthorized
 from cubicweb.schema import display_name
 from cubicweb.uilib import css_em_num_value
 from cubicweb.utils import make_uid
@@ -500,8 +500,7 @@
         return FacetVocabularyWidget
 
     def get_selected(self):
-        return frozenset(typed_eid(eid)
-                         for eid in self._cw.list_form_param(self.__regid__))
+        return frozenset(int(eid) for eid in self._cw.list_form_param(self.__regid__))
 
     def get_widget(self):
         """Return the widget instance to use to display this facet.
--- a/web/request.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/web/request.py	Thu Mar 21 19:08:07 2013 +0100
@@ -23,6 +23,7 @@
 import random
 import base64
 import urllib
+from StringIO import StringIO
 from hashlib import sha1 # pylint: disable=E0611
 from Cookie import SimpleCookie
 from calendar import timegm
@@ -114,6 +115,8 @@
             self._headers_in.addRawHeader(k, v)
         #: form parameters
         self.setup_params(form)
+        #: received body
+        self.content = StringIO()
         #: dictionary that may be used to store request data that has to be
         #: shared among various components used to publish the request (views,
         #: controller, application...)
--- a/web/views/autoform.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/web/views/autoform.py	Thu Mar 21 19:08:07 2013 +0100
@@ -127,7 +127,7 @@
 from logilab.common.decorators import iclassmethod, cached
 from logilab.common.deprecation import deprecated
 
-from cubicweb import typed_eid, neg_role, uilib
+from cubicweb import neg_role, uilib
 from cubicweb.schema import display_name
 from cubicweb.view import EntityView
 from cubicweb.predicates import (
@@ -415,7 +415,7 @@
         subjs, rtype, objs = rstr.split(':')
         for subj in subjs.split('_'):
             for obj in objs.split('_'):
-                yield typed_eid(subj), rtype, typed_eid(obj)
+                yield int(subj), rtype, int(obj)
 
 def delete_relations(req, rdefs):
     """delete relations from the repository"""
@@ -460,12 +460,12 @@
 def _add_pending(req, eidfrom, rel, eidto, kind):
     key = 'pending_%s' % kind
     pendings = req.session.data.setdefault(key, set())
-    pendings.add( (typed_eid(eidfrom), rel, typed_eid(eidto)) )
+    pendings.add( (int(eidfrom), rel, int(eidto)) )
 
 def _remove_pending(req, eidfrom, rel, eidto, kind):
     key = 'pending_%s' % kind
     pendings = req.session.data[key]
-    pendings.remove( (typed_eid(eidfrom), rel, typed_eid(eidto)) )
+    pendings.remove( (int(eidfrom), rel, int(eidto)) )
 
 @ajaxfunc(output_type='json')
 def remove_pending_insert(self, (eidfrom, rel, eidto)):
@@ -606,7 +606,7 @@
         for pendingid in pending_inserts:
             eidfrom, rtype, eidto = pendingid.split(':')
             pendingid = 'id' + pendingid
-            if typed_eid(eidfrom) == entity.eid: # subject
+            if int(eidfrom) == entity.eid: # subject
                 label = display_name(form._cw, rtype, 'subject',
                                      entity.__regid__)
                 reid = eidto
--- a/web/views/basecontrollers.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/web/views/basecontrollers.py	Thu Mar 21 19:08:07 2013 +0100
@@ -27,7 +27,7 @@
 from logilab.common.deprecation import deprecated
 
 from cubicweb import (NoSelectableObject, ObjectNotFound, ValidationError,
-                      AuthenticationError, typed_eid, UndoTransactionException,
+                      AuthenticationError, UndoTransactionException,
                       Forbidden)
 from cubicweb.utils import json_dumps
 from cubicweb.predicates import (authenticated_user, anonymous_user,
@@ -176,7 +176,7 @@
         if not '__linkto' in req.form:
             return
         if eid is None:
-            eid = typed_eid(req.form['eid'])
+            eid = int(req.form['eid'])
         for linkto in req.list_form_param('__linkto', pop=True):
             rtype, eids, target = linkto.split(':')
             assert target in ('subject', 'object')
@@ -186,7 +186,7 @@
             else:
                 rql = 'SET Y %s X WHERE X eid %%(x)s, Y eid %%(y)s' % rtype
             for teid in eids:
-                req.execute(rql, {'x': eid, 'y': typed_eid(teid)})
+                req.execute(rql, {'x': eid, 'y': int(teid)})
 
 
 def _validation_error(req, ex):
--- a/web/views/bookmark.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/web/views/bookmark.py	Thu Mar 21 19:08:07 2013 +0100
@@ -22,7 +22,7 @@
 
 from logilab.mtconverter import xml_escape
 
-from cubicweb import Unauthorized, typed_eid
+from cubicweb import Unauthorized
 from cubicweb.predicates import is_instance, one_line_rset
 from cubicweb.web import action, component, htmlwidgets, formwidgets as fw
 from cubicweb.web.views import uicfg, primary
@@ -137,4 +137,4 @@
 @ajaxfunc
 def delete_bookmark(self, beid):
     rql = 'DELETE B bookmarked_by U WHERE B eid %(b)s, U eid %(u)s'
-    self._cw.execute(rql, {'b': typed_eid(beid), 'u' : self._cw.user.eid})
+    self._cw.execute(rql, {'b': int(beid), 'u' : self._cw.user.eid})
--- a/web/views/editcontroller.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/web/views/editcontroller.py	Thu Mar 21 19:08:07 2013 +0100
@@ -25,7 +25,7 @@
 
 from rql.utils import rqlvar_maker
 
-from cubicweb import Binary, ValidationError, typed_eid
+from cubicweb import Binary, ValidationError
 from cubicweb.view import EntityAdapter, implements_adapter_compat
 from cubicweb.predicates import is_instance
 from cubicweb.web import (INTERNAL_FIELD_VALUE, RequestError, NothingToEdit,
@@ -67,7 +67,7 @@
 
 def valerror_eid(eid):
     try:
-        return typed_eid(eid)
+        return int(eid)
     except (ValueError, TypeError):
         return eid
 
@@ -217,7 +217,7 @@
             todelete = self._cw.list_form_param('__delete', formparams, pop=True)
             autoform.delete_relations(self._cw, todelete)
         if '__cloned_eid' in formparams:
-            entity.copy_relations(typed_eid(formparams['__cloned_eid']))
+            entity.copy_relations(int(formparams['__cloned_eid']))
         if is_main_entity: # only execute linkto for the main entity
             self.execute_linkto(entity.eid)
         return eid
--- a/web/views/editviews.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/web/views/editviews.py	Thu Mar 21 19:08:07 2013 +0100
@@ -23,7 +23,6 @@
 from logilab.common.decorators import cached
 from logilab.mtconverter import xml_escape
 
-from cubicweb import typed_eid
 from cubicweb.view import EntityView, StartupView
 from cubicweb.predicates import (one_line_rset, non_final_entity,
                                  match_search_state)
@@ -53,7 +52,7 @@
     def filter_box_context_info(self):
         entity = self.cw_rset.get_entity(0, 0)
         role, eid, rtype, etype = self._cw.search_state[1]
-        assert entity.eid == typed_eid(eid)
+        assert entity.eid == int(eid)
         # the default behaviour is to fetch all unrelated entities and display
         # them. Use fetch_order and not fetch_unrelated_order as sort method
         # since the latter is mainly there to select relevant items in the combo
--- a/web/views/forms.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/web/views/forms.py	Thu Mar 21 19:08:07 2013 +0100
@@ -51,7 +51,7 @@
 from logilab.common.textutils import splitstrip
 from logilab.common.deprecation import deprecated
 
-from cubicweb import ValidationError, typed_eid
+from cubicweb import ValidationError
 from cubicweb.utils import support_args
 from cubicweb.predicates import non_final_entity, match_kwargs, one_line_rset
 from cubicweb.web import RequestError, ProcessFormError
@@ -404,7 +404,7 @@
         linked_to = {}
         for linkto in self._cw.list_form_param('__linkto'):
             ltrtype, eid, ltrole = linkto.split(':')
-            linked_to.setdefault((ltrtype, ltrole), []).append(typed_eid(eid))
+            linked_to.setdefault((ltrtype, ltrole), []).append(int(eid))
         return linked_to
 
     def session_key(self):
@@ -436,7 +436,7 @@
         # created entity)
         assert eid or eid == 0, repr(eid) # 0 is a valid eid
         try:
-            return typed_eid(eid)
+            return int(eid)
         except ValueError:
             try:
                 return self._cw.data['eidmap'][eid]
--- a/web/views/magicsearch.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/web/views/magicsearch.py	Thu Mar 21 19:08:07 2013 +0100
@@ -29,7 +29,7 @@
 from rql.utils import rqlvar_maker
 from rql.nodes import Relation
 
-from cubicweb import Unauthorized, typed_eid
+from cubicweb import Unauthorized
 from cubicweb.view import Component
 from cubicweb.web.views.ajaxcontroller import ajaxfunc
 
@@ -254,7 +254,7 @@
         """
         # if this is an integer, then directly go to eid
         try:
-            eid = typed_eid(word)
+            eid = int(word)
             return 'Any X WHERE X eid %(x)s', {'x': eid}, 'x'
         except ValueError:
             etype = self._get_entity_type(word)
--- a/web/views/reledit.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/web/views/reledit.py	Thu Mar 21 19:08:07 2013 +0100
@@ -29,7 +29,7 @@
 from logilab.common.deprecation import deprecated, class_renamed
 from logilab.common.decorators import cached
 
-from cubicweb import neg_role, typed_eid
+from cubicweb import neg_role
 from cubicweb.schema import display_name
 from cubicweb.utils import json, json_dumps
 from cubicweb.predicates import non_final_entity, match_kwargs
@@ -402,7 +402,7 @@
     req = self._cw
     args = dict((x, req.form[x])
                 for x in ('formid', 'rtype', 'role', 'reload', 'action'))
-    rset = req.eid_rset(typed_eid(self._cw.form['eid']))
+    rset = req.eid_rset(int(self._cw.form['eid']))
     try:
         args['reload'] = json.loads(args['reload'])
     except ValueError: # not true/false, an absolute url
--- a/web/views/urlpublishing.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/web/views/urlpublishing.py	Thu Mar 21 19:08:07 2013 +0100
@@ -59,7 +59,7 @@
 
 from rql import TypeResolverException
 
-from cubicweb import RegistryException, typed_eid
+from cubicweb import RegistryException
 from cubicweb.web import NotFound, Redirect, component
 
 
@@ -165,7 +165,7 @@
         if len(parts) != 1:
             raise PathDontMatch()
         try:
-            rset = req.execute('Any X WHERE X eid %(x)s', {'x': typed_eid(parts[0])})
+            rset = req.execute('Any X WHERE X eid %(x)s', {'x': int(parts[0])})
         except ValueError:
             raise PathDontMatch()
         if rset.rowcount == 0:
@@ -222,7 +222,7 @@
                                     'x', 'Substitute')
         if attrname == 'eid':
             try:
-                rset = req.execute(st.as_string(), {'x': typed_eid(value)})
+                rset = req.execute(st.as_string(), {'x': int(value)})
             except (ValueError, TypeResolverException):
                 # conflicting eid/type
                 raise PathDontMatch()
--- a/web/views/urlrewrite.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/web/views/urlrewrite.py	Thu Mar 21 19:08:07 2013 +0100
@@ -19,7 +19,6 @@
 
 import re
 
-from cubicweb import typed_eid
 from cubicweb.uilib import domid
 from cubicweb.appobject import AppObject
 
@@ -186,7 +185,7 @@
                     except KeyError:
                         kwargs[key] = value
                     if cachekey is not None and key in cachekey:
-                        kwargs[key] = typed_eid(value)
+                        kwargs[key] = int(value)
             if setuser:
                 kwargs['u'] = req.user.eid
             for param in rqlformparams:
--- a/wsgi/request.py	Thu Mar 21 16:52:13 2013 +0100
+++ b/wsgi/request.py	Thu Mar 21 19:08:07 2013 +0100
@@ -38,13 +38,14 @@
 
 
 class CubicWebWsgiRequest(CubicWebRequestBase):
-    """most of this code COMES FROM DJANO
+    """most of this code COMES FROM DJANGO
     """
 
     def __init__(self, environ, vreg):
         self.environ = environ
         self.path = environ['PATH_INFO']
         self.method = environ['REQUEST_METHOD'].upper()
+        self.content = environ['wsgi.input']
 
         headers_in = dict((normalize_header(k[5:]), v) for k, v in self.environ.items()
                           if k.startswith('HTTP_'))