Hi,

I have the following formlib class:

from zope.formlib.form import Form
from zope.schema import Bytes

class myForm(Form):
    form_fields = Fields( Bytes(__name__='myFile', title=u'File') )

    template = ViewPageTemplateFile('wcForm.pt')

    @action('Run', name='run')
    def handle_run(self, action, data):
        return self.context.runJob(data)

This renders fine, but when I try to upload the file I get "Form input is not 
a file object". If I remove the template line everything works fine. I'm 
using the following page template (taken from Philipps book, 2nd ed.):


<html xmlns="http://www.w3.org/1999/xhtml";
      xmlns:tal="http://xml.zope.org/namespaces/tal";
      xmlns:metal="http://xml.zope.org/namespaces/metal";
      metal:use-macro="context/@@standard_macros/view">
<body>
    <div metal:fill-slot="body">
    <form class="edit-form" enctype="mulitpart/form-data" method="post"
        action="." tal:attributes="action request/URL">

        <h1 tal:content="view/label">Edit something</h1>

        <div class="row" tal:repeat="widget view/widgets">
            <div class="label">
                <label for="field.name" title="The widget"
                    tal:attributes="for widget/name; title widget/hint"
                    tal:content="widget/label">
                    Label
                </label>
            </div>

            <div tal:condition="widget/error"
                tal:content="structure widget/error">
                Error
            </div>

            <div class="field">
                <input tal:replace="structure widget" />
            </div>
        </div>

        <span class="actionButtons" tal:condition="view/availableActions">
           <input tal:repeat="action view/actions"
                tal:replace="structure action/render" />
        </span>

    </form>
    </div>
</body>
</html>

Can anyone tell me why I get the error message and how to fix it?

Thanks!

Svenn.
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to