On Jan 7, 3:21 pm, "Dalius Dobravolskas"
<[email protected]> wrote:

> <snip>...ToscaWidgets are nice
> and works for me but when I want to add something unusual I have to
> make hacks and other voodoo magic.
>
> --
> Daliushttp://blog.sandbox.lt

It's interesting that you say that. I've been using tw a lot lately,
and it has proved to be amazingly accommodating for the supposed fancy
stuff I'm trying to do(lots of integration with jquery plugins). It
seems to hold up pretty well, though I'll admit I suspect I may be
stretching it a little past it's original intent and likely doing
something wrong or inefficient or eventually unsupported.

Can you elaborate on the hacks/voodoo you've had to do?


as for the OP's dilemma for form variables... I feel your pain. here's
what I did which at least to me seemed to cut down on the cruft a
little bit.


I wrote a util function and dropped it in my helpers.py ...

def gather(fields,d):
    result = []
    for f in fields:
        if d.has_key(f) and d[f].strip()!='':
            result.append(d[f])
        else:
            result.append(None)
    return result


and the first line of my controller methods now looks something like
this.....

class CommentController(BaseController):
    def post_comment(self):
        entry_id,parent_id,subject,content,topic_id = h.gather
(('entry_id','parent_id','subject','content','topic_id'),request.params)
        ...


I don't know if that's any better, but it made me feel like it was a
rigid/solid way to get the vars. Someone smarter than me could
probably point out how gather could just be implemented with map and
maybe even generators. But hey, it works for me. :)



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to