Hello,

I am new to plone/zope. I am trying to use z3c forms with plone to fetch
some data from RDBMS but I am having an issue with variables passed to edit
forms using GET and POST variables.

>From what I read, the edit form needs to override the getContent function:

def getContent(self):
               #get the id from the request object
               personid = int(*self.request['entityid']*)

               #use the id to look up the person
               person = sql.getPerson(personid)

               #create a return a dictionary
               content = dict(
                       [ (name, getattr(person,name))
                       for name in self.fields.keys()])
               return content

This works and I can display values just fine, but when I do something
similar in the action handler

@button.buttonAndHandler(u'Apply',name='applyView')
       def handleApplyView(self,action):
               self.handleApply(self,action)
               if not self.widgets.errors:
                       url = absoluteURL(self.context,self.request)
                       url += '/person-view?id=' + *self.request['entityid']
*
                       self.request.response.redirect(url)


I get an error that there is no entityid key in self.request.  Inspecting
the request object seems to confirm that.
I guess my other options are to:

- Get the value from form directly with
*self.request.form.widgets.entityid*(seems like an ugly thing to do)
- Get the value from *data[]* dictionary.

What would be the best pattern for handling this type of processing?

I have used z3c.formdemo and their example (sqlmessage) but for some reason
self.request['id'] seems to work for them.

Thanks for your time

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

Reply via email to