[Cubicweb] add vocabulary options in migration process

Carlos Balderas carlos.balderas at gmail.com
Thu Mar 10 21:38:59 CET 2011


Thank you very much!

On Thu, Mar 10, 2011 at 10:18 AM, Sylvain Thénault <
sylvain.thenault at logilab.fr> wrote:

> On 10 mars 10:15, Carlos Balderas wrote:
> > Hi List!
> >
> > I am trying make a migration to change a static vocabulary in an
> attribute
> > of an entity.
> >
> > I was wondering if "sync_schema_props_perms" in a migration file would do
> > the work?, because I still don't get this change done.
> >
> > this is the case:
> >
> > frequency = String(required=True,
> >                        description=_('how often this activity has to be
> > done'),
> >                        internationalizable=True,
> >                        vocabulary=(_('daily'), _('weekly'), _('monthly'),
> > _('annual')),
> >                        default='daily')
> >
> > and I need to add two more options: permament and biweekly.
> >
> > frequency = String(required=True,
> >                        description=_('how often this activity has to be
> > done'),
> >                        internationalizable=True,
> >                        vocabulary=(_('permanent'), _('daily'),
> _('weekly'),
> >                                    _('biweekly'), _('monthly'),
> > _('annual')),
> >                        default='daily')
> >
> > What I did, was to make a the changes in the schema file and create a
> > migration file with:
> >
> > sync_schema_props_perms('ProcessStage', syncperms=False, syncprops=True,
> > syncrdefs=False, commit=True)
> >
> > where ProcessStage is the entity containing the attribute frecuency.
> >
> > I run the migration process but the new vocabulary options are not added.
> >
> > Could someone tell if this is the correct way to achieve what I need?
>
> syncrdefs=False make it skip the entity type's attributes, hence your
> vocabulary change. Either change this or use sync_schema_props_perms
> given a 3-uple defining the relation as first argument, eg
> (<EntityType>, 'frequency', 'String') in your case.
>
> --
> Sylvain Thénault                               LOGILAB, Paris (France)
> Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
> Développement logiciel sur mesure:       http://www.logilab.fr/services
> CubicWeb, the semantic web framework:    http://www.cubicweb.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20110310/5720df04/attachment-0048.html>


More information about the Cubicweb mailing list