Hi!
I'm trying to use the dublincore subjects property with a slight modification. Originally it uses TextLine but i want it to use my home made "Word" schema field type (behaves like TextLine but with no spaces)


class IWordSubjects(IDCExtended):
     subjects = Tuple(
         title = _(u'Words'),
         description = _(u"A list of words describing the object"),
         value_type = Word(title=u'Word'),
         max_length=10,
         )

Is this possible of doing? Just inheriting from IDCExtended and overriding subjects...
This was added to my addform:

form_fields = Fields(IItem).omit('__parent__', '__name__') +\
                        Fields(IWordSubjects).select('subjects')


The adding view looks as expected and it complains when word is not a word, and i cannot add more than 10 subjectwords, that's all good. But as soon as all fields are valid and it tries to create the object it fails:


File "/home/mset/Zope-3.3.1/testinstance/lib/python/foo/browser/ item.py", line 39, in create
    applyChanges(job, self.form_fields, data)
File "/home/mset/Zope-3.3.1/lib/python/zope/formlib/form.py", line 521, in applyChanges
    adapter = interface(context)
TypeError: ('Could not adapt', <foo.item.Item object at 0x3d32130>, <InterfaceClass foo.interfaces.IWordSubjects>)

Seems to be some more things i need to do in addform maybe?
Here's my create function in the addform:

     def create(self, data):
         item = createObject('foo.Item')
         applyChanges(item, self.form_fields, data)
         return item


Any ideas? I'm not sure my way of doing this is even possible, maybe there's some other very simple way?

thanks in advance
Seteva
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to