Announcing TurboGears 2.1.5 Release

96 views
Skip to first unread message

Michael Pedersen

unread,
Apr 7, 2012, 2:17:45 AM4/7/12
to tg-trunk, tg
The TurboGears team is proud to announce the release of TurboGears 2.1.4!

This release has many new features and bugfixes, all of them listed below. Due to issues with getting 2.2 released, we have chosen to produce another 2.1 based released. As a result, this release will be the final 2.1.x release, and the final release that will support Python 2.4.

We strongly recommend you upgrade. We are seeing benefits of newer template engines and faster response speeds, and it's only going to improve.
  • Backport template rendering parameters from 2.2
  • Add hook for render calls to be able to hook even partials
  • Test unit for validation messing hooks
  • Improved Jinja template support for Python 2.4
  • Avoid running wrong decoration hooks when controller is switched due to a validation error
  • Permit to avoid doctype injection when manually rendering templates with tg.render.render
  • Added new new command (tgdevelop tgdeps) to setup.cfg to help with creating a good working virtualenv.
  • Added jinja2 template loader with dotted notation.
  • Fixed multiple paginators in same page
  • Fixed missing tw.forms dependency when auth is disabled

--
Michael J. Pedersen
My Online Resume: http://www.icelus.org/ -- Google+ http://plus.ly/pedersen
Google Talk: m.ped...@icelus.org -- Twitter: pedersentg

León Domingo

unread,
Apr 7, 2012, 7:31:40 AM4/7/12
to turbo...@googlegroups.com, tg-trunk
Hi,
Congratulations for the new release!

I have a problem with the "Added jinja2 template loader with dotted notation." feature. I use Jinja as template language and my existing code does not work with this new feature.

Turbogears-2.1.5/tg/dottednames/jinja_lookup.py

20        # Check if dottedname
21        if not template.endswith('.html'):
22            # Get the actual filename from dotted finder
23            finder = config['pylons.app_globals'].dotted_filename_finder
24            template = finder.get_dotted_filename(
25                template_name=template,
26                template_extension=self.template_extension)
27        else:
28            return FileSystemLoader.get_source(self, environment, template)

I don't really understand the meaning of this code. Why the extension determines the loader to be used? I have templates with other extenions besides .html.

It's the first time i face a problem like this, How do I have to act? Will you propose some modification to this code? Do I have to apply my own patch to all my code?

Thanks in advance,
León Domingo

Ender - Factoría de Software
leon.d...@ender.es
Avda. Cerro del Águila, 7. S23 - 2ª Planta
28703 S.S. de los Reyes (MADRID)
Tlf. 902 01 44 01

   


--
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to turbo...@googlegroups.com.
To unsubscribe from this group, send email to turbogears+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/turbogears?hl=en.

Carlos Daniel Ruvalcaba Valenzuela

unread,
Apr 7, 2012, 12:46:28 PM4/7/12
to turbo...@googlegroups.com
Turbogears-2.1.5/tg/dottednames/jinja_lookup.py

20        # Check if dottedname
21        if not template.endswith('.html'):
22            # Get the actual filename from dotted finder
23            finder = config['pylons.app_globals'].dotted_filename_finder
24            template = finder.get_dotted_filename(
25                template_name=template,
26                template_extension=self.template_extension)
27        else:
28            return FileSystemLoader.get_source(self, environment, template)


This certainly look different  to what I have on my repo (215 branch), the template extension is factored out on a class variable called template_extension.


I don't really understand the meaning of this code. Why the extension determines the loader to be used? I have templates with other extenions besides .html.

It's the first time i face a problem like this, How do I have to act? Will you propose some modification to this code? Do I have to apply my own patch to all my code?

The problem here is that we need defaults, and while mako templates usually default to mak, jinja does not have a widely accepted extension, the official jinja docs suggest the .html extension, thus we use that.

I could prepare a patch to set the template extension if that is what you need, but it may get merged later.

Regards,
Carlos Ruvalcaba

León Domingo

unread,
Apr 7, 2012, 1:07:10 PM4/7/12
to turbo...@googlegroups.com
Hi,
I can make it work by commenting lines from 20 thru 27, and always load templates using FileSystemLoader I don't really need a patch to get it work, I was just wondering how these things happen. I can even wait for your patch to be merged into the trunk or whatever change that makes it work without hacking TG 2.1.5.

Thanks for your support, Carlos


León Domingo

Ender - Factoría de Software
leon.d...@ender.es
Avda. Cerro del Águila, 7. S23 - 2ª Planta
28703 S.S. de los Reyes (MADRID)
Tlf. 902 01 44 01

   


--

Carlos Daniel Ruvalcaba Valenzuela

unread,
Apr 7, 2012, 1:26:52 PM4/7/12
to turbo...@googlegroups.com
I can make it work by commenting lines from 20 thru 27, and always load templates using FileSystemLoader I don't really need a patch to get it work, I was just wondering how these things happen. I can even wait for your patch to be merged into the trunk or whatever change that makes it work without hacking TG 2.1.5.

You can also disable dotted names, in you app_cfg.py set:

base_config.use_dotted_templatenames = False

This will tell the jinja code to use FileSytemLoader directly, thus the jinja_lookup.py code will not be hit, that should revert the jinja loader behavior to work the same as 2.1.4, dotted names are not enabled by default with jinja because it is enabled by default on all other backends (for sake of homogeneity).

Regards,
Carlos Ruvalcaba

Mengu

unread,
Apr 7, 2012, 1:28:26 PM4/7/12
to TurboGears
congratulations michael.

this was a real hard work. i am looking forward for the 2.2
release. :)

On Apr 7, 9:17 am, Michael Pedersen <m.peder...@icelus.org> wrote:
> The TurboGears team is proud to announce the release of TurboGears 2.1.4!
>
> This release has many new features and bugfixes, all of them listed below.
> Due to issues with getting 2.2 released, we have chosen to produce another
> 2.1 based released. As a result, this release will be the final 2.1.x
> release, and the final release that will support Python 2.4.
>
> We strongly recommend you upgrade. We are seeing benefits of newer template
> engines and faster response speeds, and it's only going to improve.
>
>    - Backport template rendering parameters from 2.2
>    - Add hook for render calls to be able to hook even partials
>    - Test unit for validation messing hooks
>    - Improved Jinja template support for Python 2.4
>    - Avoid running wrong decoration hooks when controller is switched due
>    to a validation error
>    - Permit to avoid doctype injection when manually rendering templates
>    with tg.render.render
>    - Added new new command (tgdevelop tgdeps) to setup.cfg to help with
>    creating a good working virtualenv.
>    - Added jinja2 template loader with dotted notation.
>    - Fixed multiple paginators in same page
>    - Fixed missing tw.forms dependency when auth is disabled
>
> --
> Michael J. Pedersen
> My Online Resume:http://www.icelus.org/-- Google+http://plus.ly/pedersen
> Google Talk: m.peder...@icelus.org -- Twitter: pedersentg

León Domingo

unread,
Apr 7, 2012, 1:31:21 PM4/7/12
to turbo...@googlegroups.com
Great!
I will use the configuration setting (base_config.use_dotted_templatenames = False) instead. Much cleaner than hacking.

Regards,

León Domingo

Ender - Factoría de Software
leon.d...@ender.es
Avda. Cerro del Águila, 7. S23 - 2ª Planta
28703 S.S. de los Reyes (MADRID)
Tlf. 902 01 44 01

   


--

Alessandro Molina

unread,
Apr 8, 2012, 8:33:51 AM4/8/12
to turbo...@googlegroups.com
On 4/7/12, León Domingo <leon.d...@ender.es> wrote:
> Hi,
> Congratulations for the new release!
>
> I don't really understand the meaning of this code. Why the extension
> determines the loader to be used? I have templates with other extenions
> besides .html.

When using dotted names you are expected not to specify the extension
of the file.
The expected syntax is @expose('proj.templates.index') and not
@expose('proj.templates.index.html') for that reason the loaders
supposed that you aren't using the dotted notation if you specified an
extension to the template because in that case you probably wrote
@expose('proj/templates/index.html') and you don't want TG to be
trying to load the "proj/templates/index/html.html" file.

That is the reason why the loaders usually disable the dotted notation
format if you specified the file extension.

Alessandro Molina

unread,
Apr 8, 2012, 8:45:43 AM4/8/12
to turbo...@googlegroups.com
On 4/7/12, Carlos Daniel Ruvalcaba Valenzuela <clsd...@gmail.com> wrote:
>> *Turbogears-2.1.5/tg/dottednames/jinja_lookup.py*

>>
>> 20 # Check if dottedname
>> 21 if not template.endswith('.html'):
>> 22 # Get the actual filename from dotted finder
>> 23 finder = config['pylons.app_globals'].dotted_filename_finder
>> 24 template = finder.get_dotted_filename(
>> 25 template_name=template,
>> 26 template_extension=self.template_extension)
>> 27 else:
>> 28 return FileSystemLoader.get_source(self, environment,
>> template)
>>
>>
> This certainly look different to what I have on my repo (215 branch), the
> template extension is factored out on a class variable called
> template_extension.
>

Also the released 2.1.5 has the template_extension class variable, so
that is not strictly the 2.1.5 code. Probably he changed it while
pasting it to make more obvious the issue.

>
> I could prepare a patch to set the template extension if that is what you
> need, but it may get merged later.
>

That it probably a good idea anyway.
It would permit to use dotted loader with any kind of extension
instead of only the default one. We can probably store a dictionary
with extensions to use for each template engine inside the tg.config
(so that the user is able to change it inside the app_cfg.py) and use
that for choosing the template extension inside the loaders.

León Domingo

unread,
Apr 8, 2012, 8:51:19 AM4/8/12
to turbo...@googlegroups.com
Thanks for your support, Alessandro


León Domingo

Ender - Factoría de Software
leon.d...@ender.es
Avda. Cerro del Águila, 7. S23 - 2ª Planta
28703 S.S. de los Reyes (MADRID)
Tlf. 902 01 44 01

   


Damien Accorsi

unread,
Apr 10, 2012, 5:15:30 AM4/10/12
to turbo...@googlegroups.com
Hello,

Thanks Michael for this new release. Is there any roadmap for the future
or it's not yet decided what will be worked on?

Damien

On 04/07/2012 08:17 AM, Michael Pedersen wrote:
> The TurboGears team is proud to announce the release of TurboGears 2.1.4!
>
> This release has many new features and bugfixes, all of them listed
> below. Due to issues with getting 2.2 released, we have chosen to
> produce another 2.1 based released. As a result, this release will be
> the final 2.1.x release, and the final release that will support Python 2.4.
>
> We strongly recommend you upgrade. We are seeing benefits of newer
> template engines and faster response speeds, and it's only going to improve.
>

> * Backport template rendering parameters from 2.2
> * Add hook for render calls to be able to hook even partials
> * Test unit for validation messing hooks
> * Improved Jinja template support for Python 2.4
> * Avoid running wrong decoration hooks when controller is switched


> due to a validation error

> * Permit to avoid doctype injection when manually rendering
> templates with tg.render.render
> * Added new new command (tgdevelop tgdeps) to setup.cfg to help with


> creating a good working virtualenv.

> * Added jinja2 template loader with dotted notation.
> * Fixed multiple paginators in same page
> * Fixed missing tw.forms dependency when auth is disabled


>
>
> --
> Michael J. Pedersen
> My Online Resume: http://www.icelus.org/ -- Google+ http://plus.ly/pedersen

> Google Talk: m.ped...@icelus.org <mailto:m.ped...@icelus.org> --
> Twitter: pedersentg

Alessandro Molina

unread,
Apr 10, 2012, 5:36:51 AM4/10/12
to turbo...@googlegroups.com
On Tue, Apr 10, 2012 at 11:15 AM, Damien Accorsi <damien....@free.fr> wrote:
> Hello,
>
> Thanks Michael for this new release. Is there any roadmap for the future or
> it's not yet decided what will be worked on?
>
> Damien
>

Yes,
a few weeks ago Michael posted the report of a meeting the TurboGears
team had recently with the roadmap.

https://groups.google.com/d/topic/turbogears/N1xh_r0Sjt4/discussion

Basically:
2.2 -> the upcoming release will have as the major change the switch
to ToscaWidgets2 as the default for new applications.
Existing applications will continue to use ToscaWidgets1 and it will
also be possible to mix the two.
Dispatch will be Crank based which is faster then the current dispatch code.
Some repoze.what-* dependencies won't be necessary anymore and got removed.
Refactoring of the documentation, master/slave bultin support and
various other improvements.
This will be the last Pylons based releae
This release will drop Python 2.4 support

2.3 -> The major change will be the Pylons dependency removal.
Apps that didn't rely on the pylons namespace, but used only the tg
one (tg.request, tg.response and so on) will continue to work without
any required change.
If the application requires Pylons somehow, a compatibility mode will
be available where TG will continue to work with pylons monkeypatching
it.
This release will drop Python 2.5 support and the codebase will start
to move forward to Python3.

After 2.3 Python3 support will probably be the main focus.
For all the major changes in 2.2 and 2.3 moving forward should require
minimum changes and when the major change breaks compatibility an
option to make tg work as before will always be available.

Damien Accorsi

unread,
Apr 10, 2012, 6:35:30 AM4/10/12
to turbo...@googlegroups.com
I missed that post. Thanks Alessandro for the reminder.

Sounds good for TW2: this is one of the things I'm looking for :)

Damien

Reply all
Reply to author
Forward
0 new messages