On Fri, Jan 9, 2009 at 4:38 PM, mk <[email protected]> wrote:
>
> Hello everyone,
>
> For the app I'm going to develop, I will need sort of scripting "API" to
> it (callable from command line and/or Python or PHP library) in addition
> to normal web interface.
Read wiki how to create paster commands.

> On the face of it, it seems straightforward: just put the code like
> following in lib/
>
> def fun(params, web=True):
>  ...
Not very nice way to do that. Wrong decision.

> But. The problem is complicated a bit by validation, which I would like
> to keep the same for web UI and scripting API
With FormEncode you have validation schemas. The only thing you need
is to write validation decorator for API functions. That's all.
Default validate decorator will not fit your needs because it does a
little bit more than just validation. Look at the code of validate
function to understand how to write validator (for FormEncode). Just
plan what you need and everything else will sort out.

-- 
Dalius
http://blog.sandbox.lt

--~--~---------~--~----~------------~-------~--~----~
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