Dalius Dobravolskas wrote:
> 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.

Huh? Are you suggesting that scripting api should call 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.

1. Why do you consider it wrong? (just a plain question)

2. If it's wrong, what's right decision? (Chris Miller's suggestion to 
render JSON looks appealing to me, but you may have a different take on 
this)

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

Well I also need to render errors in two different formats.. (HTML and 
e.g. JSON) Perhaps FormEncode validator would be helpful in this regard, 
but how?

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

I need to flesh out the details re inputs (input data validation) and 
outputs (output + errors, in 2 formats), and I'm still a bit hazy on that.

Regards,
mk



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