Pyramid offers a few ways to implement the routes/controllers. The easiest when porting from Pylons is to use classes with @viewconfig, that can mimic the pylons handler classes.
This is a good example of that approach in the regular pyramid docs: https://docs.pylonsproject.org/projects/pyramid_cookbook/en/latest/pylons/views.html Pretty much everything can be supported and migrated with not too much work, except for the globals. IIRC Pylons did some weird stuff with globals that wasn't necessarily threadsafe. When moving to pyramid you can use events to define/translate "globals" into templates. For the python code, you can also update code to not use globals and take a context object as the first argument. The context object could be a request, or an object that wraps a request. In terms of templating - if there isn't a genshi package you could probably model one after pyramid_mako and port the pylons package over. It might be much faster to do that, and then lightly adapt the templates, then reinvent everything. On Tuesday, April 1, 2025 at 6:48:01 AM UTC-4 Milan Kelesi wrote: > Hello, > > We are planning to migrate an existing project from Pylons 1.0.2 to > Pyramid 2.x. > What would be the best approach to start? > I understand we need to rewrite all the controllers. > We are using Genshi templates and this does not seem to be supported in > Pyramid 2. What would be the easiest template engine to migrate to from > Genshi (Mako, Jinja2, Chameleon, ..) > Is there an easy way to reuse the existing routes, globals, application > setup? > I am currently a bit overwhelmed and not sure where to start. > I would like to get a quick win and get one simple route/controller > without authentication to work under pyramid. > > Thanks for any advice. > -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/pylons-discuss/8384c216-c22b-4e7c-9503-e3281fb8cdb3n%40googlegroups.com.
