formencode ForEach doesn't obey not_empty=True
for my schema, i want to handle delete?id=100 delete?id=100id=101id=102 and throw an error for delete? - my validators look like this: id = ForEach(Int(), not_empty=True, convert_to_list=True) however, this passes when even when i don't pass in an 'id' i've even tried All(NotEmpty(), ForEach()) that doesn't work either. i've ended up writing my own function and subclassing into SimpleFormValidator to handle this case for me (i just check if the len(values['id']) 1, and return an error message) so either i'm going about this the wrong way, or there is an error in ForEach and/or All. any suggestions? (although, i'm happy with my solution, just thought i would publish my findings) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: State of Auth with Pylons
I'd like to see the Pylons quickstart template offer an authentication/authorization solution as an option, in the same way that it offers a DB/ORM solution (SQLAlchemy) so the user can get started quickly. This may not be a bad idea at this point. Would you like to make a Trac ticket with a suggested configuration, and we'll see if the Pylons developers are comfortable with it. I certainly am. I recently came across this issue as for the first time I've been tasked with developing a Pylons based site with no legacy integration (Yay!!). I used repoze.who for authentication and rolled my own authorization, as an earlier poster had. I was amazed how flexible repoze.who really was (and really easy to get setup). Just putting my vote in. TJ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: formencode ForEach doesn't obey not_empty=True
Hi, Have you tried -- not_tested ForEach(Int(not_empty=True), ...) /not_tested Jerry On Jan 26, 5:33 am, eleith ele...@gmail.com wrote: for my schema, i want to handle delete?id=100 delete?id=100id=101id=102 and throw an error for delete? - my validators look like this: id = ForEach(Int(), not_empty=True, convert_to_list=True) however, this passes when even when i don't pass in an 'id' i've even tried All(NotEmpty(), ForEach()) that doesn't work either. i've ended up writing my own function and subclassing into SimpleFormValidator to handle this case for me (i just check if the len(values['id']) 1, and return an error message) so either i'm going about this the wrong way, or there is an error in ForEach and/or All. any suggestions? (although, i'm happy with my solution, just thought i would publish my findings) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Is Django more popular than Pylons?
From what you all say I think we do agree that it is not just a superficial question of style. It goes beyond that, and there is a price to pay -- and that the price is generally justifiable. And, as Micheal eloquently states, given the looming horizon, the line taken by pylons promises to attract more and more people in the future, as more people from other worlds will learn about what py3k really offers. But then again, the more eclipsed java developers come to pylons, the harder it will be for pylons to dearly hold on to that slippery simplicity... ! I of course agree with Jorge's argument on the advantages of a non- monolithic framework And yes of course that having different components to install will naturally give rise to numerous installation problems. But, it remains that that there were several strange setuptools-related problems when I first started to get pylons projects going, problems that I was not interested about in the very least. The bugginess on that front seems to be getting less, but without getting into endless religious discussions you have to admit there is an added sometimes-cryptic layer added about how packages are installed, where the py source code is, etc. And, simplicity suffers a little hit as a consequence. As for replacing components, I completely appreciate the possibility of doing so. If pylons did not allow me to use *the* state-of-the-art templating (that of course is http://evoque.gizmojo.org/ ;-) it would certainly be a less attractive framework. However most of the docs, default settings etc are geared towards a default profile of components, namely mako and SA. Go out of that mould, and you may have integration puzzles to solve, or in any case you are still dependent on the unused package anyway (in the case of mako). As for paste, I certainly do not want to fiddle with replacing the builtin dev web server -- has anyone (apart from pylons developers that is) even considered trying? Small anecdote about unicode issues, and migration to Py3k... unicode is unicode, be it py2 or py3. Nothing has changed conceptually in py3 on this, except that all strings are now unicode -- something that has been a best practice in py2 since how many years? As for porting evoque to py3k, once I got actually started on it, I ended up getting it done in one sitting. It was easy, mostly a superficial set of import and naming adjustments. Evoque also has a little library to automatically guess (with hints allowed) the encoding of a text file, so it certainly has to deal with encodings. But it was easy to do because the application internally was in the first place all unicode anyway. Cheers, mario On Jan 25, 2009, at 8:22 AM, Jorge Vargas wrote: On Fri, Jan 23, 2009 at 7:16 AM, Mario Ruggier ma...@ruggier.org wrote: On Jan 19, 2009, at 8:05 PM, Mike Orr wrote: On Sun, Jan 18, 2009 at 4:05 PM, walterbyrd walterb...@iname.com wrote: And if so, why? Everybody who uses Pylons knows that other frameworks exist and had maybe tried one or two others, but has made a conscious choice that they like Pylons' style better. Hi Mike, I think I understand perfectly the intention of what you are saying here, but the last almost off-handish reference to style made me do a double-take on what you mean... What I do not understand is that given all the noisy promises of an ideal world where all python web applications are built following wsgi and installed with setuptools, the difference we are talking about cannot be simply written off as a matter of style, but more architectural and philosophical. Pylons has, with the best of intentions, tried to embrace the new open-architecture as fully as possible. And, it pays and will continue to pay a fairly high price for that choice... Example of past price paid, just look at the number of what-should- be- a-non-issue installation problems in the mail archive. search django list for geodjango, search for using app X with app Y, installations issues always happen when you have more than one source of packages. That said most of the installation issues on this list are simply people trying to get authkit going enough said. Example of price to pay, iiuc, apparently wsgi/paste/whatever has some unicode issues, so pylons has to wait for those to be fixed and third-party released to be able to even consider 3.0? Excuse me? now this is interesting. I actually see that as an advantage. if some some reason paste becomes an evil thing, you simply drop it and replace it for something better. It happen to SO with SA, it has happen several times with templating engines. webob was introduced to pylons and no one didn't even notice. If you look at the other side of the track you just can't get rid of django ORM without killing half the framework. So the price to pay is that you have to think what components you have to use instead of
Re: Is Django more popular than Pylons?
On Mon, Jan 26, 2009 at 8:10 AM, Mario Ruggier ma...@ruggier.org wrote: From what you all say I think we do agree that it is not just a superficial question of style. There are two aspects to the style. One is the philosophy of WSGI to the core, and thus the choice of Paste as the first (and still only?) generic wayto configure and launch WSGI applications. The other aspect is Pylons' particular API of Routes, action signatures, context globals, render_mako, use of FormEncode and WebHelpers, etc. I came to Pylons because of the former, but others may use it because of the latter. It goes beyond that, and there is a price to pay -- and that the price is generally justifiable. And, as Micheal eloquently states, given the looming horizon, the line taken by pylons promises to attract more and more people in the future, as more people from other worlds will learn about what py3k really offers. But then again, the more eclipsed java developers come to pylons, the harder it will be for pylons to dearly hold on to that slippery simplicity... ! I of course agree with Jorge's argument on the advantages of a non- monolithic framework And yes of course that having different components to install will naturally give rise to numerous installation problems. But, it remains that that there were several strange setuptools-related problems when I first started to get pylons projects going, problems that I was not interested about in the very least. I hate to pass the buck, but this is Python's fault for not having reliable package management built in. There's nothing Pylons can do about it except switch to another programming language. Small anecdote about unicode issues, and migration to Py3k... unicode is unicode, be it py2 or py3. Nothing has changed conceptually in py3 on this, except that all strings are now unicode -- something that has been a best practice in py2 since how many years? I think the issue is that the headers are defined as strings but they're actually bytestrings in Python 3. Python changed the semantics of what a string is, and now that strings and bytestrings don't autoconvert it becomes a users' issue. -- Mike Orr sluggos...@gmail.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: formencode ForEach doesn't obey not_empty=True
On Jan 26, 5:33 am, eleith ele...@gmail.com wrote: for my schema, i want to handle delete?id=100 delete?id=100id=101id=102 and throw an error for delete? - my validators look like this: id = ForEach(Int(), not_empty=True, convert_to_list=True) however, this passes when even when i don't pass in an 'id' i've even tried All(NotEmpty(), ForEach()) that doesn't work either. i've ended up writing my own function and subclassing into SimpleFormValidator to handle this case for me (i just check if the len(values['id']) 1, and return an error message) so either i'm going about this the wrong way, or there is an error in ForEach and/or All. any suggestions? (although, i'm happy with my solution, just thought i would publish my findings) I've had similar issues in the past that I dealt with like this, not sure if this is what you're looking for or not. import formencode as fe class IdValidator(fe.FancyValidator): def _to_python(self, value, state): ret = {'id':[]} for v in value: try: ret['id'].append(int(v)) except (ValueError, TypeError): raise fe.Invalid('id must be integer', value, state) return ret class InputFormSchema(fe.Schema): allow_extra_fields = True filter_extra_fields = True id = IdValidator() --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: formencode ForEach doesn't obey not_empty=True
On Jan 26, 11:40 am, Wayne Witzel wwitz...@gmail.com wrote: On Jan 26, 5:33 am, eleith ele...@gmail.com wrote: for my schema, i want to handle delete?id=100 delete?id=100id=101id=102 and throw an error for delete? - my validators look like this: id = ForEach(Int(), not_empty=True, convert_to_list=True) however, this passes when even when i don't pass in an 'id' i've even tried All(NotEmpty(), ForEach()) that doesn't work either. i've ended up writing my own function and subclassing into SimpleFormValidator to handle this case for me (i just check if the len(values['id']) 1, and return an error message) so either i'm going about this the wrong way, or there is an error in ForEach and/or All. any suggestions? (although, i'm happy with my solution, just thought i would publish my findings) I've had similar issues in the past that I dealt with like this, not sure if this is what you're looking for or not. import formencode as fe class IdValidator(fe.FancyValidator): def _to_python(self, value, state): ret = {'id':[]} for v in value: try: ret['id'].append(int(v)) except (ValueError, TypeError): raise fe.Invalid('id must be integer', value, state) return ret class InputFormSchema(fe.Schema): allow_extra_fields = True filter_extra_fields = True id = IdValidator() Oops, ignore the dict, it will already return it to one since you have under a Schema. class IdValidator(formencode.FancyValidator): def _to_python(self, value, state): ret = [] for v in value: try: ret.append(int(v)) except (ValueError, TypeError): raise formencode.Invalid('id must be an integer', value, state) return ret --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: query inside Model?
Yes and no. I don't agree with the default Pylons session approach -- where you have 1 global db session. I tend to use a mixture of 2 things to handle sessions in the Model: 1- A Factory class manages a session pool and which type is active ( read, write, log, etc). I call out to the factory to grab a session as needed in the model. 2- I pass in explicit sessions to the model as needed. so my model might look like this: class UseraccountBase(): def get__by__email( self, dbSession, email ): return dbSession.query(self.__class__).filter ( sqlalchemy.sql.func.lower( (self.__class__).c.email ) == email.lower () ).filter_by( is_active = True ).first() and my controller would look like: def update_user(self): session_write= SessionFactory.get_or_init('write') user= model.user.Useraccount().get__by__email( session_write , 'a...@b.com' ) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: formencode ForEach doesn't obey not_empty=True
yup, that does not work. the Int validator will fail, but then the ForEach will continue on with success --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: formencode ForEach doesn't obey not_empty=True
thanks wayne. this is an acceptable workaround, i've been using a chained validator that does something similar, but it probably makes sense to just use something like yours. i implemented my workaround as a chained validator because if this is indeed a bug, when it gets fixed, i can just take out the chained validator... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: formencode ForEach doesn't obey not_empty=True
jerry, yup, that does not work. the Int validator will fail, but then the ForEach will continue on with success --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
[ANN] Rum 0.2 has been released
Hi, I'm proud to announce that we've just made the first public release of Rum and its SQLAlchemy plugin. Rum is an extensible WSGI web application to provide a RESTful interface for your app's model objects. You can think of it as an alternative to Django's admin for the non-django world. It is designed to be pluggable and support several data backends and views/form-generators but currently there are only two implemented: a data backend to handle SQLAlchemy mapped classes (RumAlchemy) and a form generator using tw.forms (tw.rum). You can read more about it at our website: http://python-rum.org and see a live demo here: http://demo.python-rum.org Enjoy, Alberto --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: State of Auth with Pylons
Have you managed to deal with the problem of login handlers and error messages, that is what happens if a user tries to log in and for whatever reason, fails? I'm currently using repoze.who, and haven't managed to overcome this major point, even though I've discussed it at length with Chris McDonough. Cheers, Tom LOL, no I haven't. We are still early enough in development of this site that I just figured I'd go back and figure that out later. What about setting a session based flash message in your custom auth plugin: class UserModelPlugin(object): def authenticate(self, environ, identity): try: username = identity['login'] password = identity['password'] except KeyError: return None success = authenticate_user(model.User, model.meta.Session, username, password) if success: return success else: environ['beaker.session']['flash'] = Some sort of explanatory failure message return None Of course you have to be using the session middleware and put your auth middleware after your session middleware. TJ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: State of Auth with Pylons
On Jan 26, 2009, at 1:18 PM, TJ Ninneman wrote: Have you managed to deal with the problem of login handlers and error messages, that is what happens if a user tries to log in and for whatever reason, fails? I'm currently using repoze.who, and haven't managed to overcome this major point, even though I've discussed it at length with Chris McDonough. Cheers, Tom LOL, no I haven't. We are still early enough in development of this site that I just figured I'd go back and figure that out later. What about setting a session based flash message in your custom auth plugin: (I'm of course thinking your using the RedirectingFromPlugin) If that's too hack-ish, what about a custom Challenger plugin which either set's a cookie or an extra qs parameter in the redirect? TJ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: formencode ForEach doesn't obey not_empty=True
On Jan 26, 2:33 am, eleith ele...@gmail.com wrote: for my schema, i want to handle delete?id=100 delete?id=100id=101id=102 and throw an error for delete? - my validators look like this: id = ForEach(Int(), not_empty=True, convert_to_list=True) however, this passes when even when i don't pass in an 'id' i've even tried All(NotEmpty(), ForEach()) that doesn't work either. i've ended up writing my own function and subclassing into SimpleFormValidator to handle this case for me (i just check if the len(values['id']) 1, and return an error message) so either i'm going about this the wrong way, or there is an error in ForEach and/or All. any suggestions? (although, i'm happy with my solution, just thought i would publish my findings) Have you seen the Pipe compound validator? I haven't used it, but I wonder it if might work for this. After taking a peek at the source[1], this might work, too: ForEach(NotEmpty(), Int()) [1] http://www.formencode.org/formencode/foreach.py.html?f=15l=126#15 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: State of Auth with Pylons
Just for the record, there's already an SQLAlchemy/Elixir-based repoze.who authenticator: http://code.gustavonarea.net/repoze.who.plugins.sa/ So you don't have to write it yourself. Cheers. PS: Regarding your problem, I think RedirectingFormPlugin is a good solution. But anyway, I think this conversation deserves its own thread. On Monday January 26, 2009 20:18:04 TJ Ninneman wrote: Have you managed to deal with the problem of login handlers and error messages, that is what happens if a user tries to log in and for whatever reason, fails? I'm currently using repoze.who, and haven't managed to overcome this major point, even though I've discussed it at length with Chris McDonough. Cheers, Tom LOL, no I haven't. We are still early enough in development of this site that I just figured I'd go back and figure that out later. What about setting a session based flash message in your custom auth plugin: class UserModelPlugin(object): def authenticate(self, environ, identity): try: username = identity['login'] password = identity['password'] except KeyError: return None success = authenticate_user(model.User, model.meta.Session, username, password) if success: return success else: environ['beaker.session']['flash'] = Some sort of explanatory failure message return None Of course you have to be using the session middleware and put your auth middleware after your session middleware. TJ -- Gustavo Narea http://gustavonarea.net/. Get rid of unethical constraints! Get freedomware: http://www.getgnulinux.org/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Is Django more popular than Pylons?
I of course agree with Jorge's argument on the advantages of a non- monolithic framework And yes of course that having different components to install will naturally give rise to numerous installation problems. But, it remains that that there were several strange setuptools-related problems when I first started to get pylons projects going, problems that I was not interested about in the very least. I hate to pass the buck, but this is Python's fault for not having reliable package management built in. There's nothing Pylons can do about it except switch to another programming language. Pylons has a nice new website, and with it is a direct link to a continuous integration status page, via Buildbot. Would it perhaps be useful to include the installation of Pylons into the continuous integration system? It does seem like various people have had issues getting Pylons to build successfully at one point or another, and this is equally important as whether the code works, in my opinion. There is a simple way to fix this problem. You work around the Python packaging system, or at least only have core developers use it to assemble a build that was generated from a continuous integration system. Then tell easy_install, or plain distutils, to just install the tar file. This is what Django does, and it isn't exactly elegant, but then again, I have never had a problem installing Django, and I have had a problem installing Pylons. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: State of Auth with Pylons
On Jan 26, 2009, at 1:33 PM, Gustavo Narea wrote: Just for the record, there's already an SQLAlchemy/Elixir-based repoze.who authenticator: http://code.gustavonarea.net/repoze.who.plugins.sa/ So you don't have to write it yourself. Cheers. PS: Regarding your problem, I think RedirectingFormPlugin is a good solution. But anyway, I think this conversation deserves its own thread. Excellent! Although I'm not sure I would personally use the Metadata provider as it must fetch the user object on every request. In the past, I've used a expunge - pickle - unpickle - merge pattern (using the session as the store). My latest project has really made me think, How often do I really NEED the full mapped User object in each request? 90%+ of the time, I just need the user_id, user_name which I can get out of the identity object (provided I set it in my metadata provider). TJ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: formencode ForEach doesn't obey not_empty=True
On Jan 26, 11:30 am, Wyatt Baldwin wyatt.lee.bald...@gmail.com wrote: On Jan 26, 2:33 am, eleith ele...@gmail.com wrote: for my schema, i want to handle delete?id=100 delete?id=100id=101id=102 and throw an error for delete? - my validators look like this: id = ForEach(Int(), not_empty=True, convert_to_list=True) however, this passes when even when i don't pass in an 'id' i've even tried All(NotEmpty(), ForEach()) that doesn't work either. i've ended up writing my own function and subclassing into SimpleFormValidator to handle this case for me (i just check if the len(values['id']) 1, and return an error message) so either i'm going about this the wrong way, or there is an error in ForEach and/or All. any suggestions? (although, i'm happy with my solution, just thought i would publish my findings) Have you seen the Pipe compound validator? I haven't used it, but I wonder it if might work for this. After taking a peek at the source[1], this might work, too: ForEach(NotEmpty(), Int()) Actually, scratch that second suggestion. I think that's just the same as ForEach(Int(not_empty=True)). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: formencode ForEach doesn't obey not_empty=True
On Jan 26, 2:30 pm, Wyatt Baldwin wyatt.lee.bald...@gmail.com wrote: On Jan 26, 2:33 am, eleith ele...@gmail.com wrote: for my schema, i want to handle delete?id=100 delete?id=100id=101id=102 and throw an error for delete? - my validators look like this: id = ForEach(Int(), not_empty=True, convert_to_list=True) however, this passes when even when i don't pass in an 'id' i've even tried All(NotEmpty(), ForEach()) that doesn't work either. i've ended up writing my own function and subclassing into SimpleFormValidator to handle this case for me (i just check if the len(values['id']) 1, and return an error message) so either i'm going about this the wrong way, or there is an error in ForEach and/or All. any suggestions? (although, i'm happy with my solution, just thought i would publish my findings) Have you seen the Pipe compound validator? I haven't used it, but I wonder it if might work for this. After taking a peek at the source[1], this might work, too: ForEach(NotEmpty(), Int()) [1]http://www.formencode.org/formencode/foreach.py.html?f=15l=126#15 From what I am seeing in the code, it isn't about ForEach not properly validating, it is about the fact that if no arguments are passed, there is no entry in to the validation loop. So it doesn't get a chance to throw the validation errors. So you'd experience the same problem as before when not actually passing in a value. If you passed in a blank id or an id that wasn't an integer that would catch it and throw the validation error accordingly. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
FormEncode and RequireIfPresent
Hi, here's source: import formencode from formencode.validators import * from webhelpers.util import UnicodeMultiDict class Form(formencode.Schema): allow_extra_fields = True create = Bool() email = Email(if_missing=None) test = String(if_missing=None) chained_validators = [ RequireIfPresent('email', present='create'), RequireIfPresent('test', present='test'), ] f = Form() data = {'create': True} f.to_python(data) And here's output: ... File /usr/lib/python2.5/site-packages/FormEncode-1.2.1-py2.5.egg/ formencode/validators.py, line 2651, in _to_python 'empty', state), value, state)}) formencode.api.Invalid: You must give a value for email And my question: is it possible to print all validation errors in this case? ('test' value is needed here too, but message about this will be print if email will be all right). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Looking for Pylons speakers
Hello, I run PostgreSQL Conference (long announcement below). We are looking for some people to speak on Pylons + PostgreSQL at East 09 in Philly. Anybody interested should submit a talk (or better yet Tutorial). Begin long infomercial: PostgreSQL Conference, U.S., East 09 will be held in Philadelphia at historic Drexel University from April 3rd through 5th. The call for papers is now out at: http://www.postgresqlconference.org/2009/east/ . As always we let our submissions define our actual tracks. If you have something you want to talk about it. Submit it. As long as it is about PostgreSQL (or doing something with PostgreSQL) we will consider it. We are seeking creative ideas about things we can do at the conference. At West we had a code sprint. The sprint was very successful as it was about all things postgresql and open source. It wasn't just hacking back end code but people worked on all kinds of things.. Is someone up for running a code sprint? There has also been specific interest in having us add (in addition to our advanced topics) a newbie track. Please do not be afraid to submit a talks on items such as: * Backing up PostgreSQL * Understanding and Configuring Autovacuum * Normalization * Trigger Happy (how to use triggers ;) * PITR -- happiness is a shipped transaction log Other topics we are interested in beyond the standard PostgreSQL architectural fanfare are: * Groovy/Grails * Django * PHP * Postgis * Pylons * SQL Alchemy So don't delay, PostgreSQL Conference, U.S. is the premeire PostgreSQL conference series for the United States PostgreSQL community! Please submit your talk here: http://www.postgresqlconference.org/2009/east/ . Sincerely, Joshua D. Drake -- PostgreSQL - XMPP: jdr...@jabber.postgresql.org Consulting, Development, Support, Training 503-667-4564 - http://www.commandprompt.com/ The PostgreSQL Company, serving since 1997 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: formencode ForEach doesn't obey not_empty=True
Hi eleith, How about following using validator instead? class AtLeastOne(ForEach): validator = Int def _to_python(self, value, state=None): value = super(AtLeastOne, self)._to_python(value, state) if len(value) 1: raise Invalid(at least one item must be selected, value, state) return value I got same error before, and found the following post. http://groups.google.com/group/toscawidgets-discuss/browse_thread/thread/a5bf406e8d63c739?tvc=2q=MultipleSelectionMixinpli=1 On 1月26日, 午後7:33, eleith ele...@gmail.com wrote: for my schema, i want to handle delete?id=100 delete?id=100id=101id=102 and throw an error for delete? - my validators look like this: id = ForEach(Int(), not_empty=True, convert_to_list=True) however, this passes when even when i don't pass in an 'id' i've even tried All(NotEmpty(), ForEach()) that doesn't work either. i've ended up writing my own function and subclassing into SimpleFormValidator to handle this case for me (i just check if the len(values['id']) 1, and return an error message) so either i'm going about this the wrong way, or there is an error in ForEach and/or All. any suggestions? (although, i'm happy with my solution, just thought i would publish my findings) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Looking for Pylons speakers
Josh - Do you know when the deadline for submissions is? I'm about to release a Pylons/PG open source project. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
FormEncode and International Languages
How are people dealing with FormEncode and International Languages? Our project is dealing with a lot of French writers typing things like é , which fails many formencode tests. This is more of an 'approach' issue: - how are you handling internationlization in Pylons from a business standpoint ? ie - what are you supporting and where ? - how are you handling this technologically ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: FormEncode and International Languages
On Monday January 26, 2009 23:20:37 Jonathan Vanasco wrote: How are people dealing with FormEncode and International Languages? You write to an international mailing list talking about international languages. Then you assume English/Spanish/* means national language to us? Tell us where you're from so that we can know what languages are international to you. Better yet, stick to internationalization. Our project is dealing with a lot of French writers typing things like é , which fails many formencode tests. Use UnicodeString instead of String: http://www.formencode.org/class-formencode.validators.UnicodeString.html I don't think the problem will be present on other validators -- at least I guess so. This is more of an 'approach' issue: - how are you handling internationlization in Pylons from a business standpoint ? ie - what are you supporting and where ? In my case, I work for a non-profit and we try to support all possible languages. Translators are all volunteers. But anyway, I think the languages to be supported always depend your target audience. - how are you handling this technologically ? Given the context, I think you're looking for this: http://pylonsbook.com/alpha1/internationalization_and_localization HTH. -- Gustavo Narea http://gustavonarea.net/. Get rid of unethical constraints! Get freedomware: http://www.getgnulinux.org/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: Looking for Pylons speakers
On Mon, 2009-01-26 at 14:13 -0800, Jonathan Vanasco wrote: Josh - Do you know when the deadline for submissions is? You got at least a month. I'm about to release a Pylons/PG open source project. -- PostgreSQL - XMPP: jdr...@jabber.postgresql.org Consulting, Development, Support, Training 503-667-4564 - http://www.commandprompt.com/ The PostgreSQL Company, serving since 1997 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---
Re: FormEncode and International Languages
fair on some points, i disagree with others. i'm in the US. the formencode author seems to be as well. 'internationalization' on most things seems to be limited to swapping in text. many of the checks, such as PlainText allow for only a subset of ascii. anything else trips an error. short of making everything a unicode string (which I aready had done) - i'm specifically wondering how people are handling validating different form elements with these shortcomings. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~--~~~~--~~--~--~---