Hello, > Huh? Are you suggesting that scripting api should call paster commands?
Actually that depends who will use scripting API. If you need to write some scripts for cron and you will be the only user of that API you shouldn't worry to much about JSON, XMLRPC, OAuth or whatever else. You just need to write paster commands. Yet another idea you are trying to be big from start. That's both good and bad. It's bad because plans are useless. Good that you will learn a little bit. But I recommend to start your application and you will get the idea what you need to learn. When I started my free-time projects with Pylons I had idea one project per month. That plan failed completely ;-) But I still enjoy programming Pylons. >>> 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) Most probably you will end writing code with a lot of "if web:" text to produce the result while technically you just need to process input, pass it to API function and format output properly. > 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) I have different vision what you meant by scripting API. > 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? Look how validate decorator works. Validation shouldn't be written in decorators. There are lot of ways to do that. I gave you hints where to look at. That should be enough ;-) Don't be afraid to read source code you will learn more than you expect. > 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. Just do it. Things will sort out. It will be much easier for us in this group to answer to actual problems not theoretical ones. -- 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 -~----------~----~----~----~------~----~------~--~---
