Import _ from cubicweb
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 25 Aug 2016 10:04:45 +0200
changeset 1501 ac389c41589c
parent 1500 b3d5cdb9eff2
child 1502 aadda8e00ec8
Import _ from cubicweb
entities/html_generation.py
hooks.py
schema/__init__.py
schema/seda2.py
views/__init__.py
views/archivetransfer.py
views/archiveunit.py
views/content.py
views/dataobject.py
views/export.py
views/sedatree.py
views/uicfg.py
views/viewlib.py
xsd2uicfg.py
xsd2yams.py
--- a/entities/html_generation.py	Thu Aug 25 09:58:24 2016 +0200
+++ b/entities/html_generation.py	Thu Aug 25 10:04:45 2016 +0200
@@ -15,11 +15,11 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 """cubicweb-seda adapter classes for generation of a profile generation as HTML"""
 
+from cubicweb import _
+
 from cubes.seda.entities.profile_generation import SEDA2ExportAdapter, content_types
 from cubes.seda.entities.profile_generation import xselement_scheme_attribute
 
-_ = unicode
-
 
 def element_uml_cardinality(occ, card_entity):
     """Return UML like cardinality for the given pyxst Occurence. Cardinality may be
--- a/hooks.py	Thu Aug 25 09:58:24 2016 +0200
+++ b/hooks.py	Thu Aug 25 10:04:45 2016 +0200
@@ -21,6 +21,7 @@
 from yams import ValidationError
 from yams.schema import role_name
 
+from cubicweb import _
 from cubicweb.predicates import is_instance, score_entity
 from cubicweb.server import hook
 
@@ -28,8 +29,6 @@
 from cubes.seda.entities.generated import CHOICE_RTYPE
 
 
-_ = unicode
-
 SEDA_PARENT_RTYPES = {}
 CHOICE_RTYPE_ROLE = dict(itertools.chain(*CHOICE_RTYPE.values()))
 CHOICE_RTYPES = set(CHOICE_RTYPE_ROLE)
--- a/schema/__init__.py	Thu Aug 25 09:58:24 2016 +0200
+++ b/schema/__init__.py	Thu Aug 25 10:04:45 2016 +0200
@@ -18,10 +18,10 @@
 from yams.buildobjs import EntityType, RelationType, RelationDefinition
 from yams.buildobjs import String
 
+from cubicweb import _
 from cubicweb.schema import ERQLExpression, RRQLExpression
 from cubes.skos import schema as skos
 
-_ = unicode
 _('1')
 _('0..1')
 _('0..n')
--- a/schema/seda2.py	Thu Aug 25 09:58:24 2016 +0200
+++ b/schema/seda2.py	Thu Aug 25 10:04:45 2016 +0200
@@ -23,10 +23,10 @@
 
 from yams.buildobjs import EntityType, RelationDefinition
 from yams.buildobjs import String, Boolean
+from cubicweb import _
 from cubicweb.schema import RQLConstraint
 from cubes.seda.schema import seda_profile_element
 
-_ = unicode
 
 @seda_profile_element()
 class SEDAArchiveTransfer(EntityType):
--- a/views/__init__.py	Thu Aug 25 09:58:24 2016 +0200
+++ b/views/__init__.py	Thu Aug 25 10:04:45 2016 +0200
@@ -18,7 +18,7 @@
 
 from yams import BASE_TYPES
 
-from cubicweb import tags, neg_role
+from cubicweb import tags, neg_role, _
 from cubicweb.utils import UStringIO
 from cubicweb.web import formwidgets as fw, formfields as ff
 # XXX alias to avoid side effect: uicfg will become our uicfg submodule. Not necessary with 3.23?
@@ -28,7 +28,6 @@
 from cubes.seda.xsd2uicfg import FIRST_LEVEL_ETYPES
 from cubes.seda.views.widgets import SEDAMetaField
 
-_ = unicode
 
 pvs = cwuicfg.primaryview_section
 afs = cwuicfg.autoform_section
--- a/views/archivetransfer.py	Thu Aug 25 09:58:24 2016 +0200
+++ b/views/archivetransfer.py	Thu Aug 25 10:04:45 2016 +0200
@@ -17,6 +17,7 @@
 
 from logilab.common.decorators import monkeypatch
 
+from cubicweb import _
 from cubicweb.predicates import is_instance
 from cubicweb.web import formwidgets as fw
 from cubicweb.web.views import tabs, uicfg, reledit
@@ -26,8 +27,6 @@
 from cubes.seda.views import viewlib, copy_rtag
 from cubes.seda.views import uicfg as sedauicfg  # noqa - ensure those rules are defined first
 
-_ = unicode
-
 at_ordered_fields = [
     ('seda_archival_agency', 'subject'),
     ('seda_transferring_agency', 'subject'),
--- a/views/archiveunit.py	Thu Aug 25 09:58:24 2016 +0200
+++ b/views/archiveunit.py	Thu Aug 25 10:04:45 2016 +0200
@@ -17,7 +17,7 @@
 
 from logilab.common.registry import objectify_predicate, yes
 
-from cubicweb import tags
+from cubicweb import tags, _
 from cubicweb.predicates import is_instance
 from cubicweb.view import EntityView
 from cubicweb.web.views import uicfg, baseviews, tabs
@@ -31,7 +31,6 @@
 from cubes.seda.views import viewlib, widgets, archivetransfer
 from cubes.seda.views import uicfg as sedauicfg  # noqa - ensure those rules are defined first
 
-_ = unicode
 
 afs = uicfg.autoform_section
 pvs = uicfg.primaryview_section
--- a/views/content.py	Thu Aug 25 09:58:24 2016 +0200
+++ b/views/content.py	Thu Aug 25 10:04:45 2016 +0200
@@ -18,6 +18,7 @@
 from logilab.common.registry import objectify_predicate
 from logilab.mtconverter import xml_escape
 
+from cubicweb import _
 from cubicweb.predicates import is_instance
 from cubicweb.web.views import tabs, uicfg
 
@@ -28,7 +29,6 @@
 from cubes.seda.views import viewlib, widgets
 from cubes.seda.views import uicfg as sedauicfg  # noqa - ensure those rules are defined first
 
-_ = unicode
 
 pvs = uicfg.primaryview_section
 pvdc = uicfg.primaryview_display_ctrl
--- a/views/dataobject.py	Thu Aug 25 09:58:24 2016 +0200
+++ b/views/dataobject.py	Thu Aug 25 10:04:45 2016 +0200
@@ -19,7 +19,7 @@
 
 from logilab.mtconverter import xml_escape
 
-from cubicweb import tags, view
+from cubicweb import tags, view, _
 from cubicweb.predicates import match_form_params, is_instance
 from cubicweb.web.views import uicfg, tabs
 
@@ -32,7 +32,6 @@
 from cubes.seda.views import viewlib
 from cubes.seda.views import uicfg as sedauicfg  # noqa - ensure those rules are defined first
 
-_ = unicode
 
 pvs = uicfg.primaryview_section
 pvdc = uicfg.primaryview_display_ctrl
--- a/views/export.py	Thu Aug 25 09:58:24 2016 +0200
+++ b/views/export.py	Thu Aug 25 10:04:45 2016 +0200
@@ -15,12 +15,11 @@
 # with this program. If not, see <http://www.gnu.org/licenses/>.
 """cubicweb-saem-ref views related to XSD download"""
 
+from cubicweb import _
 from cubicweb.predicates import is_instance, one_line_rset
 from cubicweb.web import httpcache, action
 from cubicweb.web.views import idownloadable
 
-_ = unicode
-
 
 class SEDA2DownloadRNGAction(action.Action):
     __regid__ = 'seda.seda2export.rng'
--- a/views/sedatree.py	Thu Aug 25 09:58:24 2016 +0200
+++ b/views/sedatree.py	Thu Aug 25 10:04:45 2016 +0200
@@ -15,11 +15,10 @@
 # with this program. If not, see <http://www.gnu.org/licenses/>.
 """cubicweb-seda views for ArchiveUnit"""
 
+from cubicweb import _
 from cubicweb.predicates import adaptable
 from cubicweb.web import component
 
-_ = unicode
-
 
 class SEDAArchiveUnitTree(component.EntityCtxComponent):
     """Display the whole archive unit tree."""
--- a/views/uicfg.py	Thu Aug 25 09:58:24 2016 +0200
+++ b/views/uicfg.py	Thu Aug 25 10:04:45 2016 +0200
@@ -15,11 +15,10 @@
 # with this program. If not, see <http://www.gnu.org/licenses/>.
 """THIS FILE IS GENERATED FROM SEDA 2.0 XSD FILES, DO NOT EDIT"""
 
+from cubicweb import _
 from cubicweb.web import formwidgets as fw
 from cubicweb.web.views import uicfg
 
-_ = unicode
-
 ives = uicfg.indexview_etype_section
 ives['SEDAOriginatingAgency'] = 'subobject'
 ives['SEDADataObjectVersion'] = 'subobject'
--- a/views/viewlib.py	Thu Aug 25 09:58:24 2016 +0200
+++ b/views/viewlib.py	Thu Aug 25 10:04:45 2016 +0200
@@ -15,7 +15,7 @@
 # with this program. If not, see <http://www.gnu.org/licenses/>.
 """Library of views use there and there in the interface"""
 
-from cubicweb import tags
+from cubicweb import tags, _
 from cubicweb.predicates import match_kwargs, is_instance
 from cubicweb.view import EntityView
 from cubicweb.web.views import tabs
@@ -23,8 +23,6 @@
 from cubes.seda.xsd2uicfg import FIRST_LEVEL_ETYPES
 from cubes.seda.views import add_subobjects_button
 
-_ = unicode
-
 
 class XSDMetaEntityView(EntityView):
     __regid__ = 'seda.xsdmeta'
--- a/xsd2uicfg.py	Thu Aug 25 09:58:24 2016 +0200
+++ b/xsd2uicfg.py	Thu Aug 25 10:04:45 2016 +0200
@@ -89,9 +89,9 @@
 
     def _generate(self, mapping, stream):
         self._processed = set()
+        stream.write('from cubicweb import _\n')
         stream.write('from cubicweb.web import formwidgets as fw\n')
         stream.write('from cubicweb.web.views import uicfg\n\n')
-        stream.write('_ = unicode\n\n')
         # indexview_etype_section configuration
         stream.write('ives = uicfg.indexview_etype_section\n')
         all_etypes = set()
--- a/xsd2yams.py	Thu Aug 25 09:58:24 2016 +0200
+++ b/xsd2yams.py	Thu Aug 25 10:04:45 2016 +0200
@@ -414,10 +414,10 @@
     def _generate(self, mapping, stream):
         stream.write('''from yams.buildobjs import EntityType, RelationDefinition
 from yams.buildobjs import String, Boolean
+from cubicweb import _
 from cubicweb.schema import RQLConstraint
 from cubes.seda.schema import seda_profile_element
 
-_ = unicode
 
 ''')
         self._processed_complex_rdef = set()