Re: [Zope3-Users] directlyProvides and formlib
On Sunday 23 April 2006 19:42, luis wrote: > I'm having problems getting interface.directlyProvides to work... > > does anyone know why the following code doesn't work (file is created, but > it doesnt provide the IMarker interface...) The code looks good. Are you really sure IMarker is not provided? Maybe another piece of code calls directlyProvides(), which would override this call. You should pretty much always use alsoProvides, since it does not delete the existing directly provided interfaces. Regards, Stephan -- Stephan Richter CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] directlyProvides and formlib
Hi all, I'm having problems getting interface.directlyProvides to work... does anyone know why the following code doesn't work (file is created, but it doesnt provide the IMarker interface...) ### # test.py from zope import interface from zope import schema from zope.formlib import form from zope.app.file.file import File class IMarker(interface.Interface): """ marker test interface """ class IFileUpload(interface.Interface): """ schema for uploading files""" file = schema.Bytes( title=u"File", required=True) class AddFileForm(form.AddForm): """ Add """ form_fields = form.Fields(IFileUpload) def create(self, data): file = File(data = data['file']) # this is not working, or at least is not being "saved" interface.directlyProvides(file, IMarker ) return file ### the registration is thanks. luis ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users