xor exor wrote:
Hi i'm trying some of the doc tests in the modules,but everytime i try
to use TestRequest igot lots of errors.
Which ones? We can't help you w/o error descriptions (and don't expect
anybody to execute some random code of yours, it just takes way too long).
My code is :
from zope import interface
from zope import schema
class IKisi(interface.Interface ):
""" Insan evladi"""
first=schema.TextLine(required=False,title=u'First Name')
last=schema.TextLine(required=True,title=u'Last Name')
name=['makkalot','makov']
class Dataci(object):
""" Bisiler yapcak iste insan falan"""
def getData(self):
global name
return {'first':name[0],'last':name[1]}
def setData(self,data):
global name
name[0]=data['first']
name[1]=data['last']
return u'Saved changes'
if __name__=="__main__":
from zope.app.form.browser.formview import FormView
zope.app.form isn't actively used anymore. I suggest using zope.formlib
or z3c.form instead.
View = type('View', bases=(Dataci, FormView),dict={'schema': IKisi})
Shrug! Why are you doing this instead of simply inheriting "Dataci" from
FormView, e.g.:
class Dataci(FormView):
schema = IKisi
print View
from zope.publisher.browser import TestRequest
request=TestRequest()
view=View(None,request)
print view
What is the problem???
I don't know, you haven't said anything about a problem. You just pasted
code.
Note that you probably want to say
print view()
at the end. View objects need to be called to obtain their output.
--
http://worldcookery.com -- Professional Zope documentation and training
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users