Re: [flask] Render_template syntax
- From:
- Dag Odenhall
- Date:
- 2010-08-10 @ 13:15
> Hi,
>
> On 8/10/10 3:59 AM, nhytro-python@web.de wrote:
> > Is there a reason behind the syntax when modules are concerned?
> >
> > render_template('admin/list_items.html')
> I'm open to suggestions on alternative formats for the filename string.
> It has to be a single string because otherwise you are unable to
> reference other templates from within Jinja2. Two parameters are not a
> possible solution.
>
>
> Regards,
> Armin
I like /, makes it obvious how to override module templates and makes it
easy to support this in Flask-Genshi because Genshi has a
loader.prefixed thing for doing this exactly.
Maybe the docs just needs to be more clear on the subject?
Re: [flask] Render_template syntax
- From:
- kevin beckford
- Date:
- 2010-08-10 @ 16:41
> Maybe the docs just needs to be more clear on the subject?
>
That's the solution to this issue. Why change it for all? What does it gain?
Re: [flask] Render_template syntax
- From:
- Thadeus Burgess
- Date:
- 2010-08-10 @ 19:12
I also do not mind the / syntax. As it *sorta* makes sense. Why break
backwards compatibility for a syntax issue that could be one way half
a dozen or the other.
--
Thadeus
On Tue, Aug 10, 2010 at 11:41 AM, kevin beckford <chiggsy@lazyweb.ca> wrote:
>> Maybe the docs just needs to be more clear on the subject?
>>
>
>
> That's the solution to this issue. Why change it for all? What does it gain?
>
Re: [flask] Render_template syntax
- From:
- Armin Ronacher
- Date:
- 2010-08-10 @ 20:18
Hi,
On 8/10/10 9:12 PM, Thadeus Burgess wrote:
> I also do not mind the / syntax. As it *sorta* makes sense. Why break
> backwards compatibility for a syntax issue that could be one way half
> a dozen or the other.
Additionally it has the advantage that you can use the posixpath
functions on such a string.
Regards,
Armin
Re: [flask] Render_template syntax
- From:
-
- Date:
- 2010-08-11 @ 11:34
The only disadvantage that I have seen in the threads is the issue about
backward-compatibility, this, in my opinion loses some og its weight
considering the fact that some users might want to use there existing
jinja templates, like I mentioned a few posts back, I have used the same
templates without modification in at least 3 frameworks, and now it
paradoxically does not play well with the framework from the same author.
A comprise would be to expose the template configuration so that users can
choose a loader, exactly the way Armin wanted Jinja to be used, no
constrictions.
Thanks
___________________________________________________________
Neu: WEB.DE De-Mail - Einfach wie E-Mail, sicher wie ein Brief!
Jetzt De-Mail-Adresse reservieren: https://produkte.web.de/go/demail02
[flack]
- From:
- Kenneth Reitz
- Date:
- 2010-08-10 @ 20:20
Has anyone build an example large flask application architecture repository?
Kenneth Reitz
http://kennethreitz.com/contact-me
Re: [flask] [flack]
- From:
- Francisco Souza
- Date:
- 2010-08-10 @ 23:24
Something like this: http://bitbucket.org/danjac/newsmeme ?
Cheers,
Francisco Souza
Software developer at Giran and also full time
Open source evangelist at full time
English: http://www.franciscosouza.net
Portuguese: http://www.franciscosouza.com.br
Twitter: @franciscosouza
+55 27 3026 0264
On Tue, Aug 10, 2010 at 5:20 PM, Kenneth Reitz <me@kennethreitz.com> wrote:
> Has anyone build an example large flask application architecture
> repository?
>
> Kenneth Reitz
> http://kennethreitz.com/contact-me
>
>
Re: [flask] Render_template syntax
- From:
-
- Date:
- 2010-08-10 @ 08:07
Hi Armin,
Maybe something like this:
render_template('admin:list_items.html')
render_template('admin.list_items.html')
I would actually prefer something like this:
admin = Module(__name__, url_prefix='/admin')
The static path could be inferred from the "url_prefix" or passed
explicitly as in:
admin = Module(__name__, url_prefix='/admin', static_dir="admin/media",
template_dir="admin/templates")
app.register_module(main)
app.register_module(admin)
Then the Jinja2 ChoiceLoader comes into play, it defaults to the main
applications template folder if the modules folder is not defined:
loader = ChoiceLoader([
... FileSystemLoader(admin.template_dir),
... FileSystemLoader(main.template_dir)
... ])
Why not the physical path of the file on the system using the
jinja2.FileSystemLoader() as a default? This is how I have used Jinja
wiith other frameworks, which is just GREAT, I just love Jinja, I have
used the same templates and paths with CherryPy, Circuits and Web2Py with
out changing anything.
I hope this did not come off as a rant, I apologize if it did
Thanks
----Ursprüngliche Nachricht-----
Von: Armin Ronacher <armin.ronacher@active-4.com>
Gesendet: Aug 10, 2010 8:48:59 AM
An: flask@librelist.com
Betreff: Re: [flask] Render_template syntax
>Hi,
>
>On 8/10/10 3:59 AM, nhytro-python@web.de wrote:
>> Is there a reason behind the syntax when modules are concerned?
>>
>> render_template('admin/list_items.html')
>I'm open to suggestions on alternative formats for the filename string.
> It has to be a single string because otherwise you are unable to
>reference other templates from within Jinja2. Two parameters are not a
>possible solution.
>
>
>Regards,
>Armin
___________________________________________________________
GRATIS für alle WEB.DE Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de