David Zerrenner schrieb: > Hi, i'm trying to stick together a simple blog application with > turbogears. Maybe i missed something in the docs or the mailing list, > but i discovered a little nastyness while validating my edit form. > > First, here is some code: http://paste.turbogears.org/paste/1645 > No error handling (ecxept the validation) and imports applied here, > also the code is simplified. > > My problem was that the method which leads to the form (editpost) gets > an parameter which is the post slug of the post to edit. So it goes as > a named parameter in the method signature. The point is, that i can > not assign a dynamic generated parameter to my error handler, which is > just that method as in the tutorial. > So i had to create a second methd called _editpost which takes no > named params, just the whole request params (**kw). This method knows > the post slug because i put a hidden field in the edit form which > takes the slug. > > So my code works for now, problem solved. But i think this code is a > bit ugly, since i have two methods which basically do the same thing > (not very DRY...). Am i missing some neat python syntax which i dont > know of to solve that problem? Or is this an issue of the turbogears > error handler decorator? What can i do to beautify that code?
I'm not entirely sure what you do here, but @expose(template = ".templates.postedit") def editpost(self, theslug=None, tg_errors=None): Diez --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

