# HG changeset patch # User Sylvain Thénault # Date 1272007027 -7200 # Node ID c082dea0731bed50667a85392160ad5da5c13b2a # Parent 0f54a0e128acb2eb215b716b1b74d4734920ee8a [schema] update for yams 0.29: BoundConstraint renamed to BoundaryConstraint; new constraint messages; ObjectRelation deprecated diff -r 0f54a0e128ac -r c082dea0731b debian/control --- a/debian/control Fri Apr 23 08:48:42 2010 +0200 +++ b/debian/control Fri Apr 23 09:17:07 2010 +0200 @@ -97,7 +97,7 @@ Package: cubicweb-common Architecture: all XB-Python-Version: ${python:Versions} -Depends: ${python:Depends}, graphviz, gettext, python-logilab-mtconverter (>= 0.6.0), python-logilab-common (>= 0.50.0), python-yams (>= 0.28.1), python-rql (>= 0.26.0), python-lxml +Depends: ${python:Depends}, graphviz, gettext, python-logilab-mtconverter (>= 0.6.0), python-logilab-common (>= 0.50.0), python-yams (>= 0.29.0), python-rql (>= 0.26.0), python-lxml Recommends: python-simpletal (>= 4.0), python-crypto Conflicts: cubicweb-core Replaces: cubicweb-core diff -r 0f54a0e128ac -r c082dea0731b i18n/en.po --- a/i18n/en.po Fri Apr 23 08:48:42 2010 +0200 +++ b/i18n/en.po Fri Apr 23 09:17:07 2010 +0200 @@ -54,6 +54,22 @@ msgstr "" #, python-format +msgid "%(value)r doesn't match the %(regexp)r regular expression" +msgstr "" + +#, python-format +msgid "%(value)r must be %(op)s %(boundary)s" +msgstr "" + +#, python-format +msgid "%(value)r must be <= %(boundary)s" +msgstr "" + +#, python-format +msgid "%(value)r must be >= %(boundary)s" +msgstr "" + +#, python-format msgid "%d days" msgstr "" @@ -224,6 +240,9 @@ msgid "BoundConstraint" msgstr "bound constraint" +msgid "BoundaryConstraint" +msgstr "" + msgid "Browse by category" msgstr "" @@ -2470,6 +2489,10 @@ msgid "invalid action %r" msgstr "" +#, python-format +msgid "invalid value %(value)s, it must be one of %(choices)s" +msgstr "" + msgid "is" msgstr "" @@ -3789,6 +3812,14 @@ msgid "value associated to this key is not editable manually" msgstr "" +#, python-format +msgid "value should have maximum size of %s" +msgstr "" + +#, python-format +msgid "value should have minimum size of %s" +msgstr "" + msgid "vcard" msgstr "" diff -r 0f54a0e128ac -r c082dea0731b i18n/es.po --- a/i18n/es.po Fri Apr 23 08:48:42 2010 +0200 +++ b/i18n/es.po Fri Apr 23 09:17:07 2010 +0200 @@ -59,6 +59,22 @@ msgstr "%(subject)s %(etype)s #%(eid)s (%(login)s)" #, python-format +msgid "%(value)r doesn't match the %(regexp)r regular expression" +msgstr "" + +#, python-format +msgid "%(value)r must be %(op)s %(boundary)s" +msgstr "" + +#, python-format +msgid "%(value)r must be <= %(boundary)s" +msgstr "" + +#, python-format +msgid "%(value)r must be >= %(boundary)s" +msgstr "" + +#, python-format msgid "%d days" msgstr "%d días" @@ -232,6 +248,9 @@ msgid "BoundConstraint" msgstr "" +msgid "BoundaryConstraint" +msgstr "" + msgid "Browse by category" msgstr "Busca por categoría" @@ -2529,6 +2548,10 @@ msgid "invalid action %r" msgstr "Acción %r invalida" +#, python-format +msgid "invalid value %(value)s, it must be one of %(choices)s" +msgstr "" + msgid "is" msgstr "es" @@ -3876,6 +3899,14 @@ msgid "value associated to this key is not editable manually" msgstr "el valor asociado a este elemento no es editable manualmente" +#, python-format +msgid "value should have maximum size of %s" +msgstr "" + +#, python-format +msgid "value should have minimum size of %s" +msgstr "" + msgid "vcard" msgstr "vcard" diff -r 0f54a0e128ac -r c082dea0731b i18n/fr.po --- a/i18n/fr.po Fri Apr 23 08:48:42 2010 +0200 +++ b/i18n/fr.po Fri Apr 23 09:17:07 2010 +0200 @@ -59,6 +59,22 @@ msgstr "%(subject)s %(etype)s #%(eid)s (%(login)s)" #, python-format +msgid "%(value)r doesn't match the %(regexp)r regular expression" +msgstr "%(value)r ne correspond pas à l'expression régulière %(regexp)r" + +#, python-format +msgid "%(value)r must be %(op)s %(boundary)s" +msgstr "%(value)r doit être %(op)s %(boundary)s" + +#, python-format +msgid "%(value)r must be <= %(boundary)s" +msgstr "%(value)r doit être <= %(boundary)s" + +#, python-format +msgid "%(value)r must be >= %(boundary)s" +msgstr "%(value)r doit être >= %(boundary)s" + +#, python-format msgid "%d days" msgstr "%d jours" @@ -231,6 +247,9 @@ msgid "BoundConstraint" msgstr "contrainte de bornes" +msgid "BoundaryConstraint" +msgstr "contrainte de bornes" + msgid "Browse by category" msgstr "Naviguer par catégorie" @@ -2566,6 +2585,10 @@ msgid "invalid action %r" msgstr "action %r invalide" +#, python-format +msgid "invalid value %(value)s, it must be one of %(choices)s" +msgstr "valeur %(value)s incorrect, doit être parmi %(choices)s" + msgid "is" msgstr "de type" @@ -3919,6 +3942,14 @@ msgid "value associated to this key is not editable manually" msgstr "la valeur associée à cette clé n'est pas éditable manuellement" +#, python-format +msgid "value should have maximum size of %s" +msgstr "la valeur doit être de taille %s au maximum" + +#, python-format +msgid "value should have minimum size of %s" +msgstr "la valeur doit être de taille %s au minimum" + msgid "vcard" msgstr "vcard" diff -r 0f54a0e128ac -r c082dea0731b misc/migration/3.8.1_Any.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/misc/migration/3.8.1_Any.py Fri Apr 23 09:17:07 2010 +0200 @@ -0,0 +1,2 @@ +rql('SET X name "BoundaryConstraint" ' + 'WHERE X is CWConstraintType, X name "BoundConstraint"') diff -r 0f54a0e128ac -r c082dea0731b schema.py --- a/schema.py Fri Apr 23 08:48:42 2010 +0200 +++ b/schema.py Fri Apr 23 09:17:07 2010 +0200 @@ -982,6 +982,15 @@ make_workflowable(cls) return cls +class WorkflowableEntityType(ybo.EntityType): + """Use this base class instead of :class:`EntityType` to have workflow + relations (i.e. `in_state`, `wf_info_for` and `custom_workflow`) on your + entity type. + """ + __metaclass__ = workflowable_definition + __abstract__ = True + + def make_workflowable(cls, in_state_descr=None): """Adds workflow relations as :class:`WorkflowableEntityType`, but usable on existing classes which are not using that base class. @@ -989,19 +998,17 @@ existing_rels = set(rdef.name for rdef in cls.__relations__) # let relation types defined in cw.schemas.workflow carrying # cardinality, constraints and other relation definition properties + etype = getattr(cls, 'name', cls.__name__) if 'custom_workflow' not in existing_rels: - rdef = ybo.SubjectRelation('Workflow') - yams_add_relation(cls.__relations__, rdef, 'custom_workflow') + rdef = ybo.RelationDefinition(etype, 'custom_workflow', 'Workflow') + yams_add_relation(cls.__relations__, rdef) if 'in_state' not in existing_rels: - rdef = ybo.SubjectRelation('State', description=in_state_descr) - yams_add_relation(cls.__relations__, rdef, 'in_state') + rdef = ybo.RelationDefinition(etype, 'in_state', 'State', + description=in_state_descr) + yams_add_relation(cls.__relations__, rdef) if 'wf_info_for' not in existing_rels: - rdef = ybo.ObjectRelation('TrInfo') - yams_add_relation(cls.__relations__, rdef, 'wf_info_for') - -class WorkflowableEntityType(ybo.EntityType): - __metaclass__ = workflowable_definition - __abstract__ = True + rdef = ybo.RelationDefinition('TrInfo', 'wf_info_for', etype) + yams_add_relation(cls.__relations__, rdef) # schema loading ############################################################## diff -r 0f54a0e128ac -r c082dea0731b server/schemaserial.py --- a/server/schemaserial.py Fri Apr 23 08:48:42 2010 +0200 +++ b/server/schemaserial.py Fri Apr 23 09:17:07 2010 +0200 @@ -52,7 +52,10 @@ def cstrtype_mapping(cursor): """cached constraint types mapping""" - return dict(cursor.execute('Any T, X WHERE X is CWConstraintType, X name T')) + map = dict(cursor.execute('Any T, X WHERE X is CWConstraintType, X name T')) + if not 'BoundConstraint' in map: + map['BoundConstraint'] = map['BoundaryConstraint'] + return map # schema / perms deserialization ############################################## @@ -240,10 +243,13 @@ cstrtypemap = {} rql = 'INSERT CWConstraintType X: X name %(ct)s' for cstrtype in CONSTRAINTS: + if cstrtype == 'BoundConstraint': + continue # XXX deprecated in yams 0.29 / cw 3.8.1 cstrtypemap[cstrtype] = execute(rql, {'ct': unicode(cstrtype)}, build_descr=False)[0][0] if pb is not None: pb.update() + cstrtypemap['BoundConstraint'] = cstrtypemap['BoundaryConstraint'] # serialize relations for rschema in schema.relations(): # skip virtual relations such as eid, has_text and identity