[Zope3-Users] directlyProvides and formlib
luis
lparrab at gmx.net
Sun Apr 23 19:42:31 EDT 2006
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
################################
<page
class=".test.AddFileForm"
name="test.html"
permission="zope.Public"
for="zope.app.container.interfaces.IAdding"
/>
################################
thanks. luis
More information about the Zope3-users
mailing list