Thanks a lot for the in-depth response.
I think I'll delay making the switch for now, but some time in the
future I'll def make the move and use the instructions you've
outlined. The reason I'm delaying is that it's working as it is right
now, and I think my time will be better spent on other functionality
for the app, or do you think it'll take a few hours to do and the move
is well worth it?
Thanks for apptools, I'll take a look.
Cheers
Rob
On Nov 14, 10:55 pm, Sam G <samuel.gam...@gmail.com> wrote:
> Hi Bert,
>
> I've had to make the switchover in numerous apps now, and it's not that
> difficult.
> Most of it can be done with find/replace:
>
> - `tipfy.RequestHandler` needs to be `webapp2.RequestHandler` (obvs)
> - `self.request.args.get` and `self.request.form.get` need to be replaced
> with `self.request.get`
> - if you want to be returning responses like you did in tipfy, you'll need
> to override the `dispatch` method on RequestHandler, to return what your
> get/post method returns
> - otherwise, you can write to the browser using `self.request.write` (note
> it's no longer `self.request.out.write`)
> - your URL "Rules" must be converted to "Routes." The `endpoint` kwarg must
> be changed to `name`.
> - you're gonna need to load jinja2 manually
>
> I'm not sure about multiauth (I'm in an openid setup, which is working
> fine), but sessions are pretty easy with Webapp2.
>
> As for MapReduce and Pipelines, they are framework agnostic. They work with
> Tipfy and Webapp2.
>
> Honestly, I thought the switchover would be extremely painful... it turned
> out not to be. Webapp2 is fantastically written, and if you can't find
> something in the docs, it'll be in source comments.
>
> Here are some resources to help you out further:http://blog.notdot.net/2011/10/Migrating-to-Python-2-7-part-1-Threadsafehttp://blog.notdot.net/2011/11/Migrating-to-Python-2-7-part-2-Webapp-...http://blog.notdot.net/2010/08/Using-BlobReader-wildcard-subdomains-a...
>
> I'm actually writing a library right now that makes most of these changes
> easy. It's called AppTools... still in development (so use it at your own
> risk), but the source could give you some insights. Take a look at
> "core.py" especially - it's got a RequestHandler class that loads Jinja2,
> prepares a base template context, and does a few more useful things.
>
> http://apptools.github.comhttp://www.github.com/sgammon/apptools