[Repoze-dev] [colander/deform] List-ish data/Multiselect widget
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I using the following pattern to define some properties as lists of ints: class Numbers(SequenceSchema): number = SchemaNode(Int) class MySchema(MappingSchema): products = Numbers(widget=MultiSelectWidget) field_ids = Numbers(widget=MultiSelectWidget) Inside a Zope 2 app I derived MultiSelectWidget from SelectWidget and provided a slightly different edit template generating as we would do it inside a traditional Zope 2 app. Rendering the edit view with passing in lists of ints into the form works fine. Upon submit I am using basically the following code (as Chris described here) for turning the Zope request into a webob compatible request: http://lists.repoze.org/pipermail/repoze-dev/2010-December/003706.html However this does not work properly. Common error message: "[1,2,3] is not iterable"). How should I treat a list of ints as provided by the ZPublisher in order make it compatible with the schema above? Andreas -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQGUBAEBAgAGBQJNJvqjAAoJEADcfz7u4AZjkG8Lv0n8FDjUJJ+Llr2k9f1U/67U 3C8c5/8vu7l7kpxx3rxQdVFuYgUT2KLrEwRSBFit2huSyIAgQsQIcN1DCppUuXYD UB2itKz9IH2pvQ4N3lqLCmDqpYb3TnEgRXC83WgCKtXq3hldvvcz5BmJ3EwA0id0 IFRr2fK7OB94vASkqy1eyC4JSbpoqU5lVI4MXy84r2uzlXI/LXKxuTPa2mpN/86v Pp2bifkj9NUYM0Qay3exeUezSfYH5BaCZ7Bu0/9IB63TVwAM7qQkmhgzfaXcDzxP zHqWmksCGydNxtaXZry2lob5JmmbP+tvqIHpN2VvBZuIJTDKX+Y+QsHfViceopYB wqCGLQu6NCjQC79lRd+7zX3XjsZEyLWElaOT6V22QpBK5hjcm0DH6YFenXWOs/X9 TZ2zTa1v6tbK9xaQvdkVFHxNsR1Crv14SHCNn2rVX2e+CnwaqaAUHcvQFCWxTJ4V Cp92XfL5g97o0zs6qeE2sifyFyr9Kks= =rtRt -END PGP SIGNATURE- <>___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
[Repoze-dev] [Deform/Colander] Mapping lists to multi select widget
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 What is the canonical way for defining a node as list of integers and rendering it as a multi-selection widget (http://docs.repoze.org/colander/basics.html#defining-a-colander-schema (Friend/Friends definition) however a TupleSchema with a single Integer SchemaNode does not make sense or is an one-item tuple the way to go here? Looking through the templates of the widgets I could not find any indication for a multi-selection widget - is this intentional? I assume I have to build one on my own (not a big problem). Andreas -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQGUBAEBAgAGBQJNJXLBAAoJEADcfz7u4AZjGXgLvRCuw71mtns8xu+Vabsgq0pl 4hfnzEkyHCGGILiW1L4GAgxsxp65YUmZuIrih3fXEGDfi5Rx0PCVUqH9nBP0SnGc s1lvR8pY/jiUnfnQ9+hbEx+tijXmnvNzsjAhAsAeApy8127V7BKpd4sGJLD53HA+ G3R9o76EfOHaO6toPr+pWQcwj6iuwUEs6Z9FeES5a6TtrHKKCzeJ04v/zIAqRg5r y5kijrRLHS5947eTecyXBift3a+F3CJOUPTRdPaOuxlYs5KCK0pzCa6tcICgr2pJ drHgbtEjmKa6tXRwsxNcWNhX+oAv2g9e2XheK8Py2AHVTy0qHsJjq8Z26YUvK3LL LasB8zPUyqyFylU9G73+FTQ4H+iDZwlx5i0fpmlm0s3WCY/RSDiS2UV6W5d50+DU 88qgrDcofBh3gy6KL7u0TlkD6dFe/OZ7T0EvOsTgV7gWIZOM4inNZcA34TSkUkLT 3jGCPMEdZflKsgcrD8E7/yELIODS578= =z9lm -END PGP SIGNATURE- <>___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
[Repoze-dev] docs.repoze.org down?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Andreas -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQGUBAEBAgAGBQJNJCWXAAoJEADcfz7u4AZjduwLwJF70+Bn5+sZFe+RCjWgwWsU zhc6FcaOtDcBViKtv3iDavbldquufvty+9STk9idwQeT0TYEGWKeiEif9O0LYh9p EYrxU/5v6xKB3KGNIFw/512PVhf7oo8eeccsn3ZkCdVkimdWw53r4vKBMlvh+C9O 5UMujsYInDtM4HZCv3Alcma/ah6fbFcyajeX1Zu193G88AOlUql+Ala5D4KkkePl vjyMMK0nwm7V7bCqUwYMbt9dsN9FtUmui/9yrSoWNFXynlnQFP/JjVMcrpNOl4pM oziiZuUsxn4N2Ulkr3hHHn7SzOpWhbEti/zhQs0yyp49QWvCRKTZRYWTDuk2/N46 fIOxSfl4LnCjY9o/QTNP4kMipFPxgl1bPVKSqAntK/qIZOc3Ak1wACDdLHthoiSz tShd1N1SZhdksNQagbtDXSq+fZ5HTOVAdn2J9N85EbaXX7B0YF/rtDB1eoFwxr1h S8svH6AuCyDkrae5ZT1ARN7qod3K/F4= =aDnz -END PGP SIGNATURE- <>___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] [Colander/Deform] Deserialization issue (Required error)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Andreas Jung wrote: The issue seems to be related to the Zope 2 request -> Webob request converter here: > > 18 > 19 def getDeformData(request, schema): > 20 """ Turn request into webob request for proper > 21 form data serialization. > 22 """ > 23 request.stdin.seek(0) > 24 body = request.stdin.read() > 25 req = webob.Request.blank('/', POST=body, environ=request.environ) > 26 form = deform.Form(schema, method='POST') > 27 data = form.validate(req.POST.items()) > 28 return data The Zope 2 request/form is the following (Pdb) print request.form {'__formid__': 'deform', 'titel': '0', 'autorengruppe': '1', 'strasse': '', 'bemerkung': '', 'telefon': '', 'kontakt': '', '_charset_': '', 'id': '7483', 'vita': '', 'kundennr': '', 'email2': '', 'anrede': '1', 'stip_konform': '', 'kontonr': '', 'eintritt': '', 'firma': '', 'mobil': '', 'ort2': '', '__start__': ['default:mapping', 'fibu:mapping', 'privatadresse:mapping', 'interna:mapping', 'stip:mapping'], 'vorname': 'Andreas ', 'postfach': '', 'fax2': '', 'internet': '', 'mail': '', 'ort': '', 'bemadresse': '', 'status': '0', 'fax': '', 'firma_funktion': '', 'funktion': '', 'ust': '', 'fazusatz': '', 'kreditor': '', 'plz': '', 'geburtstag': '', 'plzpostfach': '', 'benutzervorher': '', 'stip_brief': '', 'bank': '', 'telefon2': '', 'land': '2', 'name': 'Jung', 'blz': '', 'steuernr': '', 'zuverlaessigkeit': '0', 'Speichern': 'Speichern', '__end__': ['default:mapping', 'fibu:mapping', 'privatadresse:mapping', 'interna:mapping', 'stip:mapping'], 'beruf': '', 'qualifikation': '0', 'benutzer': ''} and transformed through the method above into (Pdb) print form_data {'default': {'kontakt': False, 'titel': u'0', 'bemerkung': False, 'telefon': False, 'id': 7483, 'vita': False, 'kundennr': False, 'email2': False, 'anrede': u'1', 'eintritt': False, 'firma': False, 'mobil': False, 'ort2': False, 'beruf': False, 'vorname': u'Andreas', 'fax2': False, 'internet': False, 'mail': False, 'status': u'0', 'fax': False, 'firma_funktion': False, 'funktion': False, 'persoenlich': False, 'fazusatz': False, 'geburtstag': False, 'vertraulich': False, 'telefon2': False, 'name': u'Jung'}, 'fibu': {'kontonr': False, 'blz': False, 'steuerpflichtig': False, 'kreditor': 0, 'steuernr': False, 'ust': 0, 'bank': False}, 'privatadresse': {'land': u'2', 'ort': False, 'plz': False, 'postfach': False, 'plzpostfach': False, 'strasse': False}, 'interna': {'herausgeber': False, 'autorengruppe': u'1', 'zuverlaessigkeit': u'0', 'bemadresse': False, 'anonym': False, 'benutzervorher': False, 'redakteur': False, 'qualifikation': u'0', 'benutzer': False}, 'stip': {'stip_konform': False, 'stip_brief': False}} So both empty string values for 'ust' and 'kreditor' field are turned into a numeric 0 value. Obviously a side-effect deserialize() seems to expect strings only (which make sense). I think my problem is that I trying a double deserialization here. So the code in getDeformData() seems to perform some implicit deserialization - correct? Andreas -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQGUBAEBAgAGBQJM/x28AAoJEADcfz7u4AZjaYALwMj1kwz9C225WfAOttAfiPyp tJ88a2t4YzKf4TAUcHpBPlXDwEp78feH2cfuJOlUL2oZuM/wY/Wvrx5Qv/Rw5EDN B7u0NMpnQW5FIYTktj+zQ7vALhO5VWovINALnVz40saaEp56Xm+kLiev1IPjwAa+ vL1SmGjs2JIjg236D7eQ1CMMO0Gg1MYEhaRLWpKte/iKolJnpO/2nt8I2cwXje/F v6TDKlPxodsFy7tRDL0aLjgc525MA0u4AgiRu95sTBVwWtdGgMa22tYHveOhv8cA ss+rsi6qMPrUZ166KSrGCyyFueNsyEHO4ESgrLQLiAQBrbHY6KDUgEFRqsbFqVVI 4Cwi9XcWjbBBQeGVzzZH94SUaBEszJ/dqpfaMseTToUJvW1WAE9zBYQkL13+fwCu jRNcS5CWt9mphB+R06Y236RrqiPizAvkqgMb+r1Ui3deymsi43c6Puxf5QTL1dbd TLF5UYjpeORJrx/zvX7UNSA75VO5BWE= =CKPM -END PGP SIGNATURE- <>___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] [Colander/Deform] Deserialization issue (Required error)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Chris McDonough wrote: > On Tue, 2010-12-07 at 17:06 +0100, Andreas Jung wrote: >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> Chris McDonough wrote: >>> On Tue, 2010-12-07 at 15:18 +0100, Andreas Jung wrote: >>>> -BEGIN PGP SIGNED MESSAGE- >>>> Hash: SHA1 >>>> >>>> My schema contains the following fields: >>>> >>>> 317 ust = colander.SchemaNode($ >>>> 318 colander.Float(),$ >>>> 319 title=u'Ust',$ >>>> 320 missing=0,$ >>>> 321 view_roles = [u'AutorenFiBu'],$ >>>> 322 edit_roles = [u'AutorenFiBu'],$ >>>> 323 edit_roles_on_creation = [u'AutorenFiBu'],$ >>>> 324 )$ >>>> 325 kreditor = colander.SchemaNode($ >>>> 326 colander.Integer(),$ >>>> 327 title=u'Kreditor',$ >>>> 328 missing=0,$ >>>> 329 view_roles = [u'Recherche', u'Anonymous', u'Authenticated', >>>> u'AutorenHOA'],$ >>>> 330 edit_roles = [u'AutorenRed', u'AutorenFiBu'],$ >>>> 331 edit_roles_on_creation = [u'AutorenRed', u'AutorenFiBu'],$ >>>> 332 )$ >>>> >>>> The related form data: >>>> >>>> 'fibu': {'bank': False, >>>> 'blz': False, >>>> 'kontonr': False, >>>> 'kreditor': 0, >>>> 'steuernr': False, >>>> 'steuerpflichtig': False, >>>> 'ust': 0}, >>>> >>>> Upon deserialization I get the following error: >>>> >>>> Module None, line 35, in deform_prepare >>>>- >>>>- Line 35 >>>> Module colander, line 1338, in deserialize >>>> Module colander, line 459, in deserialize >>>> Module colander, line 441, in _impl >>>> Invalid: {'default.eintritt': u'Invalid date', >>>> 'default.geburtstag': u'Invalid date', >>>> 'fibu.kreditor': u'Required', >>>> 'fibu.ust': u'Required'} >>>> >>>> >>>> fibu.kreditor+ust are available ...so why is Colander complaining here >>>> with 'Required'? >>> Are you building the form "by hand" or letting Deform autogenerate it? >> Auto-generated by deform. > > Sounds like some sort of bug. But I'm unable to repeat it. I just > created this demonstration to try it: > > http://deformdemo.repoze.org/nonrequired_number_fields/ > > Is there any way you can try to create a trimmed-down test that repeats > it? The code that renders the above site is in "deformdemo" in the > Deform source and can be run via "paster serve demo.ini". If you can > create something that has the issue in there, I can fix it. Trying to minimize it by tomorrow or even checking with the debugger... Andreas -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQGUBAEBAgAGBQJM/mAvAAoJEADcfz7u4AZjayMLvi4RiFpia3e13SvcW2mxf7em QRcEvWCkNyMpcpxRK3m6Vi3aUlCfVolforTg2us0Ay704tWc/JWaUzqZBMuRR2jY aKWdHh7o6lHk1InXE7a+fF3j3y3ArGiX1CuztLkZVahpn3La0HYst4a8l2ZIw31D df4+LrV/ip+1PtOtkgX6AjKURFqM8YPLVUQ4/Q8ZU5UB9Y/J5Q3eZ/BR2vaDpUCF 0JoMOdmtIIVfXTBxOPbk8leoLIrwmnxWSlyu8gMS6/ytRHuzNafq37RXWBGAax4K sCnP6KsHWwTeW5QVrCNWhCB7MdZVhVWxQ9w3Ic862LoBCzQhh6A8HuPVvh+5b27R tpzcgcgqGzWDn/H8t1RRZAQQKcA1KzpY+CyYoQc0de+q6fzhATp9X5s0WHmEdWsJ mvevrIiDzx/9oabdiKh/Cejz5CpBHgNbAzWHV7reogOYx2NTuLv/msWTsnMhJcxJ CcbTUvkVbENaRgPhGH+3OrBJPcXAnFU= =i2Xu -END PGP SIGNATURE- <>___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] [Colander/Deform] Deserialization issue (Required error)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Andreas Jung wrote: >>> >>> fibu.kreditor+ust are available ...so why is Colander complaining here >>> with 'Required'? >> Are you building the form "by hand" or letting Deform autogenerate it? > > Auto-generated by deform. The only Zope 2 specific code is turning a Zope 2 request upon submission into a webob request using the following code: 15 # bindings for deferred select lists 16 bindings = context.get_author_bindings() 17 schema = AutorSchema().bind(**bindings) 18 19 def getDeformData(request, schema): 20 """ Turn request into webob request for proper 21 form data serialization. 22 """ 23 request.stdin.seek(0) 24 body = request.stdin.read() 25 req = webob.Request.blank('/', POST=body, environ=request.environ) 26 form = deform.Form(schema, method='POST') 27 data = form.validate(req.POST.items()) 28 return data 29 30 31 if request.get('Speichern'): 32 33 form_data = getDeformData(request, schema) 34 import pdb; pdb.set_trace() 35 deserialized = schema.deserialize(form_data) But 'data' seems to be fine (as shown in my initial posting). Andreas -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQGUBAEBAgAGBQJM/lxLAAoJEADcfz7u4AZj7i4Lv1F54FnVTMgGBx4VEM3PnIyx bEo4sWSE13K3zUtVVUtwERs4xIDvHi0pI81hoVtZEp+KdNMl+D8nbc7HEwL4ycW0 IOtW4BxW9tFnEac1qma0NoK3HF3/u5SOAj/bB66w9chQR2D8TTrd89+33vejf0N+ tFP8LVsqVIRLiApEr8rQUYCqYKVls8P1FJI4iL7vR7/WtYy0bY6MGoGTFHqw53Q7 PQPEHRrS0+BhJ6bPipyLAkWXsllV9K+Uce+g5IBbahfnAKpQg1xCYQ5CJLeIYqXK FaNlXXtlO4NoEPRITasAfwRw+iiFzmimu2+Yk2tDrP4qmqEDb88PPM2fdYMR/8GB JaaOuWWwVbrjZ5Z5g9DUrerBTffCnwefi1PphE8YOSxLeiF3Nl2si5sDNUA8Z/t7 VbQZIzN0cCOT5bNgWXQIO6kJSOmfaDcmbPMWCPcDlL0+h28L3yKYK6vEWxswRU5H Vy/hOiQU0ICAWaQmKmrP7XgEZVUcpNA= =kp8P -END PGP SIGNATURE- <>___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] [Colander/Deform] Deserialization issue (Required error)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Chris McDonough wrote: > On Tue, 2010-12-07 at 15:18 +0100, Andreas Jung wrote: >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> My schema contains the following fields: >> >> 317 ust = colander.SchemaNode($ >> 318 colander.Float(),$ >> 319 title=u'Ust',$ >> 320 missing=0,$ >> 321 view_roles = [u'AutorenFiBu'],$ >> 322 edit_roles = [u'AutorenFiBu'],$ >> 323 edit_roles_on_creation = [u'AutorenFiBu'],$ >> 324 )$ >> 325 kreditor = colander.SchemaNode($ >> 326 colander.Integer(),$ >> 327 title=u'Kreditor',$ >> 328 missing=0,$ >> 329 view_roles = [u'Recherche', u'Anonymous', u'Authenticated', >> u'AutorenHOA'],$ >> 330 edit_roles = [u'AutorenRed', u'AutorenFiBu'],$ >> 331 edit_roles_on_creation = [u'AutorenRed', u'AutorenFiBu'],$ >> 332 )$ >> >> The related form data: >> >> 'fibu': {'bank': False, >> 'blz': False, >> 'kontonr': False, >> 'kreditor': 0, >> 'steuernr': False, >> 'steuerpflichtig': False, >> 'ust': 0}, >> >> Upon deserialization I get the following error: >> >> Module None, line 35, in deform_prepare >>- >>- Line 35 >> Module colander, line 1338, in deserialize >> Module colander, line 459, in deserialize >> Module colander, line 441, in _impl >> Invalid: {'default.eintritt': u'Invalid date', >> 'default.geburtstag': u'Invalid date', >> 'fibu.kreditor': u'Required', >> 'fibu.ust': u'Required'} >> >> >> fibu.kreditor+ust are available ...so why is Colander complaining here >> with 'Required'? > > Are you building the form "by hand" or letting Deform autogenerate it? Auto-generated by deform. Andreas -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQGUBAEBAgAGBQJM/luJAAoJEADcfz7u4AZj6bkLwM/y4C+e4wq1eE1neNw8bzEM oRt/5ZfZ9vPXvhAzE2pU5huWQAdQ8kcwuqHetQm2s+AsGQ66EAgf5T8ePywi8upx YocY0xsrA5Adrr5yKG6xOzWPcfLZMpfh1+3CJGueBULAHIm5VstFzunx3xaS3J7F lZRmEH55s4VMK6aZv937c7zKEtXW2XodmBCF2fhU++71ZNbhxJWaT0O2Zx8HeOSM EsVVHE08Gm4xpZAsuDGdURmUR+dgd26canmmDbMIISSxgWPHvDv2SkhmVzpyyeAN hWL/HNkPR1YrURdLcL2ygX3bhIK1rSDukX2YNY084m6qwTOJiLDo7dDXoP07eKBF mDHmhpgWLNLrx7CSdH9izTgi6bUJGonedk1KZbGOmNug3XFupU7g1ogJhv5zLMYg fCKw3A15et9nh2uVp+ZluUE+xa8UepcG/bymnrKYGMsB8MBZN4JRSOyWrmJggpBB L7VZ12Yw7nPAkRGlaaSI9OiBhoE3F1w= =jgh9 -END PGP SIGNATURE- <>___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] [Colander] Issue with colander.deferred - AttributeError: 'deferred' object has no attribute 'hidden'
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Josip Delic wrote: > Am Dienstag, den 07.12.2010, 15:11 +0100 schrieb Andreas Jung: >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> >> SOLVED - one must call explictly bind() on the schema in this case. >> >> Andreas > > Hey Andreas, > > you are using it with "five.pt" to add chameleon templates to zope2!? Nope - just rendering the HTML form snippet from a browser view or even a portal_skins script and throwing it into the main slot of Plone. - -aj -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQGUBAEBAgAGBQJM/kiyAAoJEADcfz7u4AZjmOELwM+o2CYdEKIq7sJvgtaX28F3 ONLwWcphaZN40Jg4yxQuHjG3VMgQkg53c8EyOx1BTckyYQiu2hZdPheKZU3KY2Lf JLBtwIz7N7kG1kD4GuaHFbvxTKaogam/V2VEXr4sLQU3f0xunvG3jqKH601XNQZ5 Qk3sEUUZ+9AxMl45KqP7tNYC3l3cYVCXilyJAZuQiT/7gQnV0/kRpd9qokVEdyHZ q8yabHbM6utyo35vC2G/9F8fiHiXGXXZVBWYu0UNTUA/NJLvC68krgtF930XxqYJ lYo3Cu+kkqYZXFKwD8DRz7uQ6b4BGzjucIjgPeYgKGKraw1n7H5891HqYJ7YqDZR 1vvxt5W9PTCclWcbsORXN8LkMvhEDbG/FP+bvEmRNPKu2cGtNXunOqpTe/nopPVM qGYyVajDrsHK2j8aH/aGSyhBoDgDI+iZCTutTtoPQiS4Rdz+OlZK7zfDGvGTDyZ8 EhaVewLbVfjj0Mrb9017WZXMJE7pqD0= =VoWB -END PGP SIGNATURE- <>___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
[Repoze-dev] [Colander/Deform] Deserialization issue (Required error)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 My schema contains the following fields: 317 ust = colander.SchemaNode($ 318 colander.Float(),$ 319 title=u'Ust',$ 320 missing=0,$ 321 view_roles = [u'AutorenFiBu'],$ 322 edit_roles = [u'AutorenFiBu'],$ 323 edit_roles_on_creation = [u'AutorenFiBu'],$ 324 )$ 325 kreditor = colander.SchemaNode($ 326 colander.Integer(),$ 327 title=u'Kreditor',$ 328 missing=0,$ 329 view_roles = [u'Recherche', u'Anonymous', u'Authenticated', u'AutorenHOA'],$ 330 edit_roles = [u'AutorenRed', u'AutorenFiBu'],$ 331 edit_roles_on_creation = [u'AutorenRed', u'AutorenFiBu'],$ 332 )$ The related form data: 'fibu': {'bank': False, 'blz': False, 'kontonr': False, 'kreditor': 0, 'steuernr': False, 'steuerpflichtig': False, 'ust': 0}, Upon deserialization I get the following error: Module None, line 35, in deform_prepare - - Line 35 Module colander, line 1338, in deserialize Module colander, line 459, in deserialize Module colander, line 441, in _impl Invalid: {'default.eintritt': u'Invalid date', 'default.geburtstag': u'Invalid date', 'fibu.kreditor': u'Required', 'fibu.ust': u'Required'} fibu.kreditor+ust are available ...so why is Colander complaining here with 'Required'? Andreas -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQGUBAEBAgAGBQJM/kIkAAoJEADcfz7u4AZjN5MLwLaLOta/eDtg+LjVQQSze07T 7Ui+eEFYaoLwdtqyA1OPLOl07K0zaXdJNzsMkj0N9cO6RkhCKZsgpm65eOnfUjwX pLuBvutMivp+chbnTAz+DrMeQFI0i2eC5nucdKQXW9DZyekxCKvw9xVO3S+HT+La ZdVS+oqB6k064Cz2YZRljr1M1Qfoxpe5OnUPqgrkxOMMaz77l8J8RD8kP4bZCppi 8hNoQng6KwA4tLHpskp0kDFZhZD7I8zTTcy28rE8OM+cIKqo9dpacdtN+SXTXG4a wRWdnjuOkasNfbPZSUDK7w7uD9EnDbzSWXlPC6gh9B5qFDQy2EKwlJn7q458LwQC nNWzK/sHhSRMSMQ+7Z0NekTtNG0GKH8BclN1txLKnu35pWZfNcG+zSeRdT9ZOcM+ Cm7/HkJHYE03wVkTLtslCZWyyKMe87mXi1LKiq6FD2BWkohYFvpaFzoCvipUB6R1 T+vOS2nUeAgttXqewa60xh784M69qWY= =nDJz -END PGP SIGNATURE- <>___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] [Colander] Issue with colander.deferred - AttributeError: 'deferred' object has no attribute 'hidden'
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 SOLVED - one must call explictly bind() on the schema in this case. Andreas Andreas Jung wrote: > Using Colander/Deform inside a Zope 2.11 using the following schema > definition: > > > > import deform > import colander > > @colander.deferred > def selection_status(node, kw): > values = kw.get('status', []) > return deform.widget.SelectWidget(values=values) > > class DefaultSchema(colander.MappingSchema): > anrede = colander.SchemaNode( > colander.String(), > title=u'Anrede', > widget=selection_status, > view_roles = ['Recherche', 'Anonymous', 'Authenticated', > 'AutorenFiBu', 'AutorenHOA'], > edit_roles = ['AutorenFiBu'], > edit_roles_on_creation = ['AutorenRed', 'AutorenFiBu'], > ) > > > Rendering the template fails: > > Traceback (innermost last): > > Module ZPublisher.Publish, line 126, in publish > Module ZPublisher.mapply, line 88, in mapply > Module ZPublisher.Publish, line 46, in call_object > Module Shared.DC.Scripts.Bindings, line 316, in __call__ > Module Shared.DC.Scripts.Bindings, line 353, in _bindAndExec > Module Products.CMFCore.FSPageTemplate, line 216, in _exec > Module Products.CMFCore.FSPageTemplate, line 155, in pt_render > Module Products.PageTemplates.PageTemplate, line 96, in pt_render > Module zope.pagetemplate.pagetemplate, line 115, in pt_render > Module zope.tal.talinterpreter, line 271, in __call__ > Module zope.tal.talinterpreter, line 346, in interpret > Module zope.tal.talinterpreter, line 910, in do_useMacro > Module zope.tal.talinterpreter, line 346, in interpret > Module zope.tal.talinterpreter, line 539, in do_optTag_tal > Module zope.tal.talinterpreter, line 524, in do_optTag > Module zope.tal.talinterpreter, line 519, in no_tag > Module zope.tal.talinterpreter, line 346, in interpret > Module zope.tal.talinterpreter, line 968, in do_defineSlot > Module zope.tal.talinterpreter, line 346, in interpret > Module zope.tal.talinterpreter, line 764, in do_insertStructure_tal > Module Products.PageTemplates.Expressions, line 223, in evaluateStructure > Module zope.tales.tales, line 696, in evaluate > URL: > file:/local/HRS2/Devel/junga/hrs_trunk/parts/products-svn/AutorenDB2/skins/autorendb2/deform.xpt > Line 17, Column 8 > Expression: > Names: > {'container': , > 'context': , > 'default': , > 'here': , > 'loop': {}, > 'nothing': None, > 'options': {'args': ()}, > 'repeat': 0x2aaab04224d0>, > 'request': http://hdev:8080/Test/adb/deform>, > 'root': , > 'template': , > 'user': } > Module zope.tales.expressions, line 217, in __call__ > Module Products.PageTemplates.Expressions, line 163, in _eval > Module Products.PageTemplates.Expressions, line 115, in render > Module Products.PageTemplates.ZRPythonExpr, line 79, in call_with_ns > Module Products.CMFCore.FSPythonScript, line 135, in > __render_with_namespace__ > Module Shared.DC.Scripts.Bindings, line 330, in __render_with_namespace__ > Module Shared.DC.Scripts.Bindings, line 353, in _bindAndExec > Module Products.CMFCore.FSPythonScript, line 196, in _exec > Module None, line 25, in deform_prepare > > Line 25 > Module deform.field, line 419, in render > Module deform.field, line 394, in serialize > Module deform.widget, line 791, in serialize > Module deform.template, line 103, in __call__ > Module chameleon.core.template, line 103, in __call__ > Module chameleon.core.template, line 394, in render > Module chameleon.zpt.template, line 17, in render > Module chameleon.core.template, line 221, in render > Module chameleon.core.template, line 373, in cook_and_render > Module chameleon.core.template, line 209, in cook_and_render > __traceback_info__: ( /local/HRS2/Devel/junga/hrs_trunk/eggs/deform-0.8-py2.4.egg/deform/templates/form.pt>,) > Module chameleon_53e47ea76efd9f4bb68ebdb1440a64e2d2819387, line 307, in > render > Module deform.template, line 103, in __call__ > Module chameleon.core.template, line 103, in __call__ > Module chameleon.core.template, line 394, in render > Module chameleon.zpt.template, line 17, in render > Module chameleon.core.template, line 221, in render > Module chameleon.core.template, line 373, in cook_and_render > Module chameleon.core.template, line 209, in cook_and_render > __traceback_info__: ( /local/HRS2/Devel/junga/hrs_trunk/eggs/deform-0.8-py2.4.egg/deform/templates/mapping_item.pt>,) > Module chameleon_9a2a51e2a4e74828462
[Repoze-dev] [Colander] Issue with colander.deferred - AttributeError: 'deferred' object has no attribute 'hidden'
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Using Colander/Deform inside a Zope 2.11 using the following schema definition: import deform import colander @colander.deferred def selection_status(node, kw): values = kw.get('status', []) return deform.widget.SelectWidget(values=values) class DefaultSchema(colander.MappingSchema): anrede = colander.SchemaNode( colander.String(), title=u'Anrede', widget=selection_status, view_roles = ['Recherche', 'Anonymous', 'Authenticated', 'AutorenFiBu', 'AutorenHOA'], edit_roles = ['AutorenFiBu'], edit_roles_on_creation = ['AutorenRed', 'AutorenFiBu'], ) Rendering the template fails: Traceback (innermost last): Module ZPublisher.Publish, line 126, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 46, in call_object Module Shared.DC.Scripts.Bindings, line 316, in __call__ Module Shared.DC.Scripts.Bindings, line 353, in _bindAndExec Module Products.CMFCore.FSPageTemplate, line 216, in _exec Module Products.CMFCore.FSPageTemplate, line 155, in pt_render Module Products.PageTemplates.PageTemplate, line 96, in pt_render Module zope.pagetemplate.pagetemplate, line 115, in pt_render Module zope.tal.talinterpreter, line 271, in __call__ Module zope.tal.talinterpreter, line 346, in interpret Module zope.tal.talinterpreter, line 910, in do_useMacro Module zope.tal.talinterpreter, line 346, in interpret Module zope.tal.talinterpreter, line 539, in do_optTag_tal Module zope.tal.talinterpreter, line 524, in do_optTag Module zope.tal.talinterpreter, line 519, in no_tag Module zope.tal.talinterpreter, line 346, in interpret Module zope.tal.talinterpreter, line 968, in do_defineSlot Module zope.tal.talinterpreter, line 346, in interpret Module zope.tal.talinterpreter, line 764, in do_insertStructure_tal Module Products.PageTemplates.Expressions, line 223, in evaluateStructure Module zope.tales.tales, line 696, in evaluate URL: file:/local/HRS2/Devel/junga/hrs_trunk/parts/products-svn/AutorenDB2/skins/autorendb2/deform.xpt Line 17, Column 8 Expression: Names: {'container': , 'context': , 'default': , 'here': , 'loop': {}, 'nothing': None, 'options': {'args': ()}, 'repeat': , 'request': http://hdev:8080/Test/adb/deform>, 'root': , 'template': , 'user': } Module zope.tales.expressions, line 217, in __call__ Module Products.PageTemplates.Expressions, line 163, in _eval Module Products.PageTemplates.Expressions, line 115, in render Module Products.PageTemplates.ZRPythonExpr, line 79, in call_with_ns Module Products.CMFCore.FSPythonScript, line 135, in __render_with_namespace__ Module Shared.DC.Scripts.Bindings, line 330, in __render_with_namespace__ Module Shared.DC.Scripts.Bindings, line 353, in _bindAndExec Module Products.CMFCore.FSPythonScript, line 196, in _exec Module None, line 25, in deform_prepare Line 25 Module deform.field, line 419, in render Module deform.field, line 394, in serialize Module deform.widget, line 791, in serialize Module deform.template, line 103, in __call__ Module chameleon.core.template, line 103, in __call__ Module chameleon.core.template, line 394, in render Module chameleon.zpt.template, line 17, in render Module chameleon.core.template, line 221, in render Module chameleon.core.template, line 373, in cook_and_render Module chameleon.core.template, line 209, in cook_and_render __traceback_info__: (,) Module chameleon_53e47ea76efd9f4bb68ebdb1440a64e2d2819387, line 307, in render Module deform.template, line 103, in __call__ Module chameleon.core.template, line 103, in __call__ Module chameleon.core.template, line 394, in render Module chameleon.zpt.template, line 17, in render Module chameleon.core.template, line 221, in render Module chameleon.core.template, line 373, in cook_and_render Module chameleon.core.template, line 209, in cook_and_render __traceback_info__: (,) Module chameleon_9a2a51e2a4e74828462e65a50a39b7df03fa54a4, line 213, in render Module deform.field, line 394, in serialize Module deform.widget, line 791, in serialize Module deform.template, line 103, in __call__ Module chameleon.core.template, line 103, in __call__ Module chameleon.core.template, line 394, in render Module chameleon.zpt.template, line 17, in render Module chameleon.core.template, line 221, in render Module chameleon.core.template, line 373, in cook_and_render Module chameleon.core.template, line 209, in cook_and_render __traceback_info__: (,) Module chameleon_4c7845e5d9fdd29e8b476d2bb96b0be5f0b7dfd8, line 182, in render Module deform.template, line 103, in __call__ Module chameleon.core.template, line 103, in __call__ Module chameleon.core.template, line 394, in render Module chameleon.zpt.template, line 17, in render Module chameleon.core.template, line 221, in render Module chameleon.core.template, line 373, in cook_and_render Module chameleon.core.template, line 209, in cook_and_render __traceback_info__: (,) Module chameleon_9a2a51e2a4e74828462e65
Re: [Repoze-dev] [Deform] Problem w/ appstruct /Form defaults
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Andreas Jung wrote: > data = {'default.vorname' : 'Andreas'} Solved - mea culpa..this must be a nested dict. Andreas -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQGUBAEBAgAGBQJM/TTsAAoJEADcfz7u4AZjJSELvi9NfYXrQ9uQ9Yk/U4z5WRo2 +Jh7Vhr1I+hF17X8fZYmxAP5g5QzQDroa0XKGC8SEtHkaHEpUxQ7de8SpJi278gj cdJ77zK1nhL1yw8WkSZHAC3ABu7nSwqahU7VzLhQoAl2Hs+8Qd81q0j9aPDTExqz A0oOiedzDAptk7b3S9C3WPV3vKNJ3otfWzU6RQX/bB0pGly9EJhLJIW3sgqKfmWa fr5vPwUvBAzsXgxT/j76VcO03sbrdWWY135hR2uZx4vl2eievCt/7u+IxfuHXgE4 VkMzYmpDi1Lo3NT4vAvLxtSRT0HP93P29FyOWtfMKDOln9wzPFUfWx/4eYhBuwRz flCP6J4FYXxG+DCU+5lNNH+ikrnysG07nJdgv0KC5Q6nVAJvea/j/eUagrO6H/1F pW2Ojkc+9CnQoyFfNVE01r8aVHNWyS0i7a2/2tS5z8xN/qM0SCf0wOsOIh77GNH3 wU8u9Rf/Gnk9cVDxMVQmraGvuQh5rco= =P1aU -END PGP SIGNATURE- <>___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
[Repoze-dev] [Deform] Problem w/ appstruct /Form defaults
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I have the following schema definition where the 'vorname' field should be rendered with 'Andreas' as default value. class DefaultSchema(colander.MappingSchema): vorname = colander.SchemaNode( colander.String(), title=u'Vorname', ) class MySchema(colander.MappingSchema): default = DefaultSchema() schema = MySchema() myform = Form(schema, buttons=('submit',)) data = {'default.vorname' : 'Andreas'} file('out.html', 'w').write(myform.render(data) However the input field remains empty. Anything I am missing here? Andreas -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQGUBAEBAgAGBQJM/TK+AAoJEADcfz7u4AZjKEALwJragIqrTf/dt2xFXjaLZWMX dGW+ut3INvERVx2fyISft/sfxm7PMEq7LneOd76jX+rzKLG8USuhyCK1apQEQ2Sw +kmmfv9ED/4AUHgmLJ38bf1UsSV8ZBGohXua1LDM22Od494+cBQRZoNBshAu0FXM RIKcDHaHvYOAuVG6H99aK9nSBB1JeIMlQEaUnGvBirFhtbCQhbaZW7ELar5czg/K UAVTdBxD+5bpnmrjTDPs/j2kkBmBMhNPxQwSZYL1NL/rFmZlgTu1jspzfyjzVFBh l5UCdIgtX9YtKp+cS6BJZ0M2aspjQFCn82zonhG87xmWkelM0GA9U9RerTWMk5N7 8j4mASZdViIEd013zoPdX1hS8uwOrnCbOaXXnG7vZHL95oQXMKQdcvsuWR0eSe3s NY7ZYbsfT87nNKGgJugdpeDTcAppSAUuqSVo/PROQFJ6LPpjwqRDFMx1QcoGQcpr O2hNKE/2je4hc9rwOp3pr7qaSlxk0tc= =ZNe2 -END PGP SIGNATURE- <>___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
[Repoze-dev] Some questions on Deform
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi there, I am currently evaluating Deform + Colander for an upcoming project. Open questions: Is there some support (in the renderer) for grouping fields? E.g. we have a "Person" form with fields for business and privat address. The related fields should be grouped together (e.g. through a fieldset). Does Deform provide some kind of "View" mode support (beside the rendering of the edit form itself) - similar to View/Edit mode in Archetypes? What is the strategy for "filtered" edit forms. E.g. a Manager should be allowed to edit all fields of a "Person" - a standard editor should be allowed to edit only a subset of the fields - all other fields should be either hidden or show as text ("View" mode). Andreas -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQGUBAEBAgAGBQJM95EyAAoJEADcfz7u4AZjc5ALv2SPU5byuFJbAPAMAk3eN9bf XbPcXe58qlauMeY22a5nHfiGQpdZAeW74ebAJEz2GeIk3Qd2w3Gng8aLnkd+XDK/ 9x6SRAYeBm5o97vtNrxCx8Pyu/gxIs/512cVGMru68QG+Pw03K93ZcOW7bzrwK4/ nyPjE5nJfYm91lLqz7CEV22ww3SjA6ngNI7uAgugtKV6+V0cI8KwNivDHrR5rn4r mhCFoigjAe3fKq+d1Lg2BHTcoEQH7vb3gMiB0wbFD/sXl510ziyj8wmv/uqNyDKU Nfm5gSBG00tEs9kfjSZ4AWiXf3q0kHnORrIRo2JeQM8U5o4ELKoXjPOeA9UfA26l FtIESaLD0yzwj1YpjHsryliLB/nh2Ap879szVGvSAWYuNdTdIgSiO86VkFvYXrlY 53VdGtNd9c+19YMn8Pe3BOQelbvi+xXSys3ipcNXth+x8GafTmXEhdlzdusN6rAC ZbFeHMLlBilE85DI5Am99iGDleFlXL0= =tFFC -END PGP SIGNATURE- <>___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
[Repoze-dev] Best practice approach for protection against cross-site-scripting and cross-site request forgery
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi there, well the subject says it all..is there some recommended approach for protecting a BFG app against XSS and CSRF? I looked at plone.protect - but at least inside a buildout it tries to pull in a complete Zope 2 egg :-> Andreas - -- ZOPYX Limited | zopyx group Charlottenstr. 37/1 | The full-service network for Zope & Plone D-72070 Tübingen| Produce & Publish www.zopyx.com | www.produce-and-publish.com - E-Publishing, Python, Zope & Plone development, Consulting -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkwIqwwACgkQCJIWIbr9KYyUJQCg5b//R8kqRdIAtbo7ZIMt3DaL YkMAoIPCoGcVqc+0h+hkZnRIBaDGS6sc =0i2K -END PGP SIGNATURE- <>___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] Using the multiprocessing module
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Shane Hathaway wrote: > On 04/10/2010 07:00 AM, Andreas Jung wrote: >> is it save to use the 'multiprocessing' module inside a BFG app? >> In particular I need to maintain a multiprocessing.Pool() instance... >> this is working at the first glance however the BFG app won't shutdown >> in a clean way when stopped through a keyboard interrupt. The apps >> hangs usually inside the following code: > > In general, it is not safe to use multiprocessing except at the top > level of any application. I would set up the multiple processes before > creating the WSGI stack or importing anything from any web framework. > I am using the multiprocessing in several Zope 2 apps on the "product" layer without issues. So this is working usually. In this case I tried using multiprocessing at a much higher level.. Andreas -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkvD52QACgkQCJIWIbr9KYw/YgCg2run+tsoXYvlsNQJMBDxCr3q 9sIAoOlqIHyfcPxSs5AZX88sNWILwVPN =qO39 -END PGP SIGNATURE- <>___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
[Repoze-dev] Using the multiprocessing module
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi there, is it save to use the 'multiprocessing' module inside a BFG app? In particular I need to maintain a multiprocessing.Pool() instance... this is working at the first glance however the BFG app won't shutdown in a clean way when stopped through a keyboard interrupt. The apps hangs usually inside the following code: File "/opt/python-2.6.4/lib/python2.6/atexit.py", line 24, in _run_exitfuncs func(*targs, **kargs) File "/opt/python-2.6.4/lib/python2.6/multiprocessing/util.py", line 260, in _exit_function _run_finalizers(0) File "/opt/python-2.6.4/lib/python2.6/multiprocessing/util.py", line 235, in _run_finalizers finalizer() File "/opt/python-2.6.4/lib/python2.6/multiprocessing/util.py", line 174, in __call__ res = self._callback(*self._args, **self._kwargs) File "/opt/python-2.6.4/lib/python2.6/multiprocessing/pool.py", line 363, in _terminate_pool cls._help_stuff_finish(inqueue, task_handler, len(pool)) File "/opt/python-2.6.4/lib/python2.6/multiprocessing/pool.py", line 348, in _help_stuff_finish inqueue._rlock.acquire() There is a Pool.terminate() method for closing the pool manually however I don't know exactly where to trigger the code. Thoughts? Andreas -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkvAdm4ACgkQCJIWIbr9KYwUCwCeIl2swbQg61OkMdYXfaR5EWPE 2tkAoOoZ/KN/tIRLCBiBP8tKttJMc9ok =pn9J -END PGP SIGNATURE- <>___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
[Repoze-dev] [bfg 1.29a] render_template_to_response returning the view class?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Running the zopyx.smartprintng.server tests with Repoze 1.2a9: Calling the index() view no longer returns a response object with a status attribute: > /data/develop/repository/svn.zope.org/zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/tests.py(96)test_index() - -> self.assertEqual(result.status, '200 OK') (Pdb) list 91 def test_index(self): 92 from zopyx.smartprintng.server.views import index 93 context = Server() 94 request = testing.DummyRequest() 95 result = index(context, request) 96 ->self.assertEqual(result.status, '200 OK') 97 body = result.app_iter[0] 98 self.assertEqual(len(result.headerlist), 2) 99 self.assertEqual(result.headerlist[0], 100 ('Content-Type', 'text/html; charset=UTF-8')) 101 self.assertEqual(result.headerlist[1], ('Content-Length', (Pdb) print result So 'result' is now the view class itself? 36 @bfg_view(for_=Server, request_method='GET', permission='read') 37 class index(object): 38 """ The default view providing some system information """ 39 40 def __init__(self, context, request): 41 self.context = context 42 self.request = request 43 44 def __call__(self): 45 converters = self.context.availableConverters() 46 version = pkg_resources.require('zopyx.smartprintng.server')[0].version· 47 return render_template_to_response('templates/index.pt', 48context=self.context, 49converters=converters, 50request=self.request, 51version=version, 52 project='zopyx.smartprintng.server') Andreas -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAks/f9gACgkQCJIWIbr9KYxEpACfWsrY42pivfgSJJX5d0GtL8fC dWgAoJu2McNlFv7BlTmDC4hz9oWttwTA =Cibm -END PGP SIGNATURE- <>___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] fun benchmarks.
Am 01.12.09 06:59, schrieb Chris McDonough: > > That would be somewhere around 8K - 9K requests per second, depending on whom > you believe. > > That's pretty snappy hardware for not much money. I don't think we have much > excuse for slow web apps anymore. Just geil! Andreas <>___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] [bfg 1.2a1] Required specification must be a specification or class.
Am 29.11.09 15:52, schrieb Chris McDonough: > Andreas Jung wrote: >> Tried to get zopyx.smartprintng.server working w/ BFG 1.2a1. This fails >> badly. >> Anything I am missing? > > Thanks for trying it. I have fixed this on the trunk and your server > now starts. > > For maximum forward compatibility, you'll probably eventually want to > change: > > @bfg_view(for_=Server, request_type='GET', permission='read') > > to: > > @bfg_view(for_=Server, request_method='GET', permission='read') > > (ie. request_type -> request_method) Thanks, this worked. Andreas <>___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
[Repoze-dev] [bfg 1.2a1] Required specification must be a specification or class.
Tried to get zopyx.smartprintng.server working w/ BFG 1.2a1. This fails badly. Anything I am missing? Andreas aj...@suxmac2:~/src/svn.zope.org/zopyx.smartprintng.server/trunk bin/paster serve server.ini SmartPrintNG server started Temp directory: /var/folders/Ov/OvU++3BsFOaXK0Lrm8F4CTI/-Tmp-/zopyx.smartprintng.server Spool directory: /var/folders/Ov/OvU++3BsFOaXK0Lrm8F4CTI/-Tmp-/zopyx.smartprintng.server-spool Available converters: ebook-calibre, fo, odt-xfc, ooxml-xfc, pdf-prince, pdf-xinc, rtf-xfc, wml-xfc No auth module found - serving for anonymous Traceback (most recent call last): File "bin/paster", line 8, in load_entry_point('PasteScript==1.7.3', 'console_scripts', 'paster')() File "/Users/ajung/src/svn.zope.org/zopyx.smartprintng.server/trunk/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/command.py", line 84, in run invoke(command, command_name, options, args[1:]) File "/Users/ajung/src/svn.zope.org/zopyx.smartprintng.server/trunk/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/command.py", line 123, in invoke exit_code = runner.run(args) File "/Users/ajung/src/svn.zope.org/zopyx.smartprintng.server/trunk/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/command.py", line 218, in run result = self.command() File "/Users/ajung/src/svn.zope.org/zopyx.smartprintng.server/trunk/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/serve.py", line 276, in command relative_to=base, global_conf=vars) File "/Users/ajung/src/svn.zope.org/zopyx.smartprintng.server/trunk/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/serve.py", line 313, in loadapp **kw) File "/Users/ajung/src/svn.zope.org/zopyx.smartprintng.server/trunk/lib/python2.6/site-packages/PasteDeploy-1.3.3-py2.6.egg/paste/deploy/loadwsgi.py", line 204, in loadapp return loadobj(APP, uri, name=name, **kw) File "/Users/ajung/src/svn.zope.org/zopyx.smartprintng.server/trunk/lib/python2.6/site-packages/PasteDeploy-1.3.3-py2.6.egg/paste/deploy/loadwsgi.py", line 225, in loadobj return context.create() File "/Users/ajung/src/svn.zope.org/zopyx.smartprintng.server/trunk/lib/python2.6/site-packages/PasteDeploy-1.3.3-py2.6.egg/paste/deploy/loadwsgi.py", line 625, in create return self.object_type.invoke(self) File "/Users/ajung/src/svn.zope.org/zopyx.smartprintng.server/trunk/lib/python2.6/site-packages/PasteDeploy-1.3.3-py2.6.egg/paste/deploy/loadwsgi.py", line 110, in invoke return fix_call(context.object, context.global_conf, **context.local_conf) File "/Users/ajung/src/svn.zope.org/zopyx.smartprintng.server/trunk/lib/python2.6/site-packages/PasteDeploy-1.3.3-py2.6.egg/paste/deploy/util/fixtypeerror.py", line 57, in fix_call val = callable(*args, **kw) File "/Users/ajung/src/svn.zope.org/zopyx.smartprintng.server/trunk/zopyx/smartprintng/server/run.py", line 38, in app return make_app(get_root, zopyx.smartprintng.server, options=kw) File "/Users/ajung/src/svn.zope.org/zopyx.smartprintng.server/trunk/lib/python2.6/site-packages/repoze.bfg-1.2a1-py2.6.egg/repoze/bfg/configuration.py", line 1523, in make_app config.load_zcml(zcml_file) File "/Users/ajung/src/svn.zope.org/zopyx.smartprintng.server/trunk/lib/python2.6/site-packages/repoze.bfg-1.2a1-py2.6.egg/repoze/bfg/configuration.py", line 323, in load_zcml xmlconfig.file(filename, package, execute=True) File "/Users/ajung/src/svn.zope.org/zopyx.smartprintng.server/trunk/lib/python2.6/site-packages/zope.configuration-3.6.0-py2.6.egg/zope/configuration/xmlconfig.py", line 649, in file context.execute_actions() File "/Users/ajung/src/svn.zope.org/zopyx.smartprintng.server/trunk/lib/python2.6/site-packages/zope.configuration-3.6.0-py2.6.egg/zope/configuration/config.py", line 605, in execute_actions callable(*args, **kw) File "/Users/ajung/src/svn.zope.org/zopyx.smartprintng.server/trunk/lib/python2.6/site-packages/repoze.bfg-1.2a1-py2.6.egg/repoze/bfg/configuration.py", line 897, in scan register_decorations(name, ob) File "/Users/ajung/src/svn.zope.org/zopyx.smartprintng.server/trunk/lib/python2.6/site-packages/repoze.bfg-1.2a1-py2.6.egg/repoze/bfg/configuration.py", line 885, in register_decorations self.add_view(view=ob, _info=_info, **setting) File "/Users/ajung/src/svn.zope.org/zopyx.smartprintng.server/trunk/lib/python2.6/site-packages/repoze.bfg-1.2a1-py2.6.egg/repoze/bfg/configuration.py", line 590, in add_view view_iface, name, info=_info) File "/Users/ajung/src/svn.zope.org/zopyx.smartprintng.server/trunk/lib/python2.6/site-packages/zope.component-3.8.0-py2.6.egg/zope/component/registry.py", line 184, in registerAdapter required = _getAdapterRequired(factory, required) File "/Users/ajung/src/svn.zope.org/zopyx.smartprintng.server/trunk/lib/python2.6/site-packages/zope.component-3.8.0-py2.6.egg/zope/component/registry.py", line 423, in _getAdapterRequired r
[Repoze-dev] Restricting access on a per-IP address basis
Hi there, I have repoze.bfg app listening 0.0.0.0 (started using paster serve). What is the best practice for restricting access to the server to a number of IP addresses other than through a firewall. Is there some WSGI middleware doing the filtering? I think writing a WSGI filter would not be too hard but how to configure this with the server.ini? Just looking for the missing link. Tnx, Andreas -- ZOPYX Ltd. & Co KG \ ZOPYX & Friends Charlottenstr. 37/1 \ The experts for your Python, Zope and D-72070 Tübingen \ Plone projects www.zopyx.com, i...@zopyx.com \ www.zopyx.de/friends, frie...@zopyx.de E-Publishing, Python, Zope & Plone development, Consulting <>___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
[Repoze-dev] How to pass additional configuration parameters
Hi, is there a common pattern for passing additional configuration parameters to a repoze.bfg app (either through the paster server cmdline call or through the server.ini file)? Is there some common API or approach for doing that? Andreas -- ZOPYX Ltd. & Co KG \ ZOPYX & Friends Charlottenstr. 37/1 \ The experts for your Python, Zope and D-72070 Tübingen \ Plone projects www.zopyx.com, i...@zopyx.com \ www.zopyx.de/friends, frie...@zopyx.de E-Publishing, Python, Zope & Plone development, Consulting <>___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev