Okay... I've adjusted makeLower and it works now:
def makeLower(obj, val, **kwargs):
s = str(val)
import pdb;pdb.set_trace()
s = s.lower()
setattr(obj,kwargs['fieldName'],s) #perhaps should be newFieldName
obj.update()
return obj.getCountry() #val
I'm sure there is a prettier way, but it works.
On Wed, Feb 27, 2008 at 12:43 PM, David Bain <[EMAIL PROTECTED]> wrote:
> Actually.
> I'm getting an error from the makeLower method.
>
> ..... in makeLower val.update(s, obj) AttributeError: 'unicode'
> object has no attribute 'update'
>
>
>
> On Wed, Feb 27, 2008 at 12:38 PM, David Bain <[EMAIL PROTECTED]> wrote:
> > set up a custom migrator:
> >
> > class MPANGFieldMigrator(InlineFieldActionMigrator):
> > # source type info
> > walkerClass = CatalogWalker
> > src_meta_type = 'MPA'
> > src_portal_type = 'MPA'
> >
> > dst_meta_type = 'MPA'
> > dst_portal_type = 'MPA'
> >
> > fieldActions = ({'fieldName' : 'country',
> > 'storage' : AttributeStorage(),
> >
> > 'transform' : makeLower,
> > },
> >
> > )
> >
> > The original value in the field is u'Mexico' but it doesn't end up
> > returning u'mexico' instead I get u'' after migration
> >
> > The method 'makeLower'
> > is based on code from:
> >
> http://svn.plone.org/svn/collective/contentmigration/trunk/src/Products/contentmigration/tests/cmtc.py
> >
> > def makeLower(obj, val, **kwargs):
> > s = str(val)
> > s = s.lower()
> > val.update(s, obj)
> > return val
> >
>
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers