[cleanup] drop some appengine support junk
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 04 Nov 2011 13:03:56 +0100
changeset 8056 8909800a8c51
parent 8055 368d8902e597
child 8057 0f128fd3cbc8
[cleanup] drop some appengine support junk
mail.py
migration.py
rqlrewrite.py
web/views/basecontrollers.py
--- a/mail.py	Fri Nov 04 13:03:52 2011 +0100
+++ b/mail.py	Fri Nov 04 13:03:56 2011 +0100
@@ -25,11 +25,7 @@
 from email.mime.text import MIMEText
 from email.mime.image import MIMEImage
 from email.header import Header
-try:
-    from socket import gethostname
-except ImportError:
-    def gethostname(): # gae
-        return 'XXX'
+from socket import gethostname
 
 from cubicweb.view import EntityView
 from cubicweb.entity import Entity
--- a/migration.py	Fri Nov 04 13:03:52 2011 +0100
+++ b/migration.py	Fri Nov 04 13:03:56 2011 +0100
@@ -34,6 +34,7 @@
 
 from cubicweb import ConfigurationError, ExecutionError
 from cubicweb.cwconfig import CubicWebConfiguration as cwcfg
+from cubicweb.toolsutils import show_diffs
 
 def filter_scripts(config, directory, fromversion, toversion, quiet=True):
     """return a list of paths of migration files to consider to upgrade
@@ -417,8 +418,6 @@
         return removed
 
     def rewrite_configuration(self):
-        # import locally, show_diffs unavailable in gae environment
-        from cubicweb.toolsutils import show_diffs
         configfile = self.config.main_config_file()
         if self._option_changes:
             read_old_config(self.config, self._option_changes, configfile)
--- a/rqlrewrite.py	Fri Nov 04 13:03:52 2011 +0100
+++ b/rqlrewrite.py	Fri Nov 04 13:03:56 2011 +0100
@@ -207,7 +207,7 @@
             vi = {}
             self.varinfos.append(vi)
             try:
-                vi['const'] = typed_eid(selectvar) # XXX gae
+                vi['const'] = typed_eid(selectvar)
                 vi['rhs_rels'] = vi['lhs_rels'] = {}
             except ValueError:
                 try:
@@ -660,7 +660,7 @@
             selectvar, index = self.revvarmap[node.name]
             vi = self.varinfos[index]
             if vi.get('const') is not None:
-                return n.Constant(vi['const'], 'Int') # XXX gae
+                return n.Constant(vi['const'], 'Int')
             return n.VariableRef(stmt.get_variable(selectvar))
         vname_or_term = self._get_varname_or_term(node.name)
         if isinstance(vname_or_term, basestring):
--- a/web/views/basecontrollers.py	Fri Nov 04 13:03:52 2011 +0100
+++ b/web/views/basecontrollers.py	Fri Nov 04 13:03:56 2011 +0100
@@ -31,14 +31,10 @@
 from cubicweb.uilib import exc_message
 from cubicweb.selectors import authenticated_user, anonymous_user, match_form_params
 from cubicweb.mail import format_mail
-from cubicweb.web import Redirect, RemoteCallFailed, DirectResponse
+from cubicweb.web import Redirect, RemoteCallFailed, DirectResponse, facet
 from cubicweb.web.controller import Controller
 from cubicweb.web.views import vid_from_rset, formrenderers
 
-try:
-    from cubicweb.web import facet as facetbase
-except ImportError: # gae
-    facetbase = None
 
 def jsonize(func):
     """decorator to sets correct content_type and calls `json_dumps` on
@@ -489,25 +485,24 @@
             return None
         return cb(self._cw)
 
-    if facetbase is not None:
-        @jsonize
-        def js_filter_build_rql(self, names, values):
-            form = self._rebuild_posted_form(names, values)
-            self._cw.form = form
-            builder = facetbase.FilterRQLBuilder(self._cw)
-            return builder.build_rql()
+    @jsonize
+    def js_filter_build_rql(self, names, values):
+        form = self._rebuild_posted_form(names, values)
+        self._cw.form = form
+        builder = facet.FilterRQLBuilder(self._cw)
+        return builder.build_rql()
 
-        @jsonize
-        def js_filter_select_content(self, facetids, rql, mainvar):
-            # Union unsupported yet
-            select = self._cw.vreg.parse(self._cw, rql).children[0]
-            filtered_variable = facetbase.get_filtered_variable(select, mainvar)
-            facetbase.prepare_select(select, filtered_variable)
-            update_map = {}
-            for facetid in facetids:
-                facet = facetbase.get_facet(self._cw, facetid, select, filtered_variable)
-                update_map[facetid] = facet.possible_values()
-            return update_map
+    @jsonize
+    def js_filter_select_content(self, facetids, rql, mainvar):
+        # Union unsupported yet
+        select = self._cw.vreg.parse(self._cw, rql).children[0]
+        filtered_variable = facet.get_filtered_variable(select, mainvar)
+        facet.prepare_select(select, filtered_variable)
+        update_map = {}
+        for fid in facetids:
+            fobj = facet.get_facet(self._cw, fid, select, filtered_variable)
+            update_map[fid] = fobj.possible_values()
+        return update_map
 
     def js_unregister_user_callback(self, cbname):
         self._cw.unregister_callback(self._cw.pageid, cbname)