IRC Logs

2008 9
Mo Tu We Th Fr Sa So
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30          

18. 09 2008

[00:01:13] * maix has quit IRC
[00:02:36] <CIA-49> python-doctools: georg.brandl * r66477 /doctools/trunk/ (sphinx/latexwriter.py doc/config.rst): Add footer element.
[00:15:43] * jpcw2002 has quit IRC
[00:18:54] * highwaychile has quit IRC
[00:23:29] * saptah has quit IRC
[01:56:32] <davidcramer> if only there was a useful form library out there
[01:56:48] <davidcramer> http://www.pastethat.com/BQf8N -- cant even contemplate how much of a royal pita this would be to do in newforms
[02:19:58] <steg> yeah, formencode is a useful form library :P
[02:20:33] <steg> and i remember hating newforms but i can't remember why
[02:21:22] <steg> i think i remember they forgot that sometimes forms are complicated
[02:21:27] <CIA-49> python-doctools: georg.brandl * r66477 /doctools/trunk/ (sphinx/latexwriter.py doc/config.rst): Add footer element.
[02:21:58] <steg> ditto with django's ORM
[02:22:35] <steg> sometimes queries and models can be complicated
[02:22:42] <steg> and the template language
[02:22:46] <steg> sometimes templates need to be complicated
[02:22:51] <steg> hmm i'm sensing a common theme
[02:32:34] <davidcramer> ya
[02:33:52] <davidcramer> tbh
[02:33:54] <davidcramer> all my forms are complicatedx
[02:33:58] <davidcramer> if they're not, i dont use newforms
[02:34:04] <davidcramer> i want shiny js crap everywhere :P
[02:34:13] <davidcramer> and i dont wanna write python code to output all this html for the most part
[02:41:05] <davidcramer> btw mitsuhiko you guys figure out Kaelten's problem yesterday -- was it Jinja2 related?
[03:10:52] <CIA-49> python-doctools: georg.brandl * r66477 /doctools/trunk/ (sphinx/latexwriter.py doc/config.rst): Add footer element.
[03:16:33] * davidcramer has quit IRC
[03:18:44] * davidcramer has joined #pocoo
[03:33:38] * CIA-49 has quit IRC
[03:35:54] * CIA-49 has joined #pocoo
[03:37:38] * davidcramer has quit IRC
[03:58:16] <CIA-49> python-doctools: georg.brandl * r66477 /doctools/trunk/ (sphinx/latexwriter.py doc/config.rst): Add footer element.
[03:58:17] <CIA-49> python-doctools: georg.brandl * r66477 /doctools/trunk/ (sphinx/latexwriter.py doc/config.rst): Add footer element.
[03:58:23] <CIA-49> python-doctools: georg.brandl * r66477 /doctools/trunk/ (sphinx/latexwriter.py doc/config.rst): Add footer element.
[04:11:07] * Baumichel has quit IRC
[04:48:12] * leche has quit IRC
[04:48:34] * aconbere has quit IRC
[04:50:27] * rawb has quit IRC
[04:52:00] * rawb has joined #pocoo
[05:02:42] <CIA-49> python-doctools: georg.brandl * r66477 /doctools/trunk/ (sphinx/latexwriter.py doc/config.rst): Add footer element.
[05:02:44] <CIA-49> python-doctools: georg.brandl * r66478 /doctools/trunk/ (5 files in 4 dirs): Add Japanese translation, provided by Yasushi Masuda.
[05:02:44] <CIA-49> python-doctools: georg.brandl * r66479 /doctools/trunk/sphinx/locale/ja/LC_MESSAGES/sphinx.po: Add po file.
[05:02:45] <CIA-49> python-doctools: georg.brandl * r66481 /doctools/trunk/ (CHANGES sphinx/highlighting.py): Allow lexer guessing.
[05:02:47] <CIA-49> python-doctools: georg.brandl * r66482 /doctools/trunk/tests/test_markup.py: Adapt markup test to renaming of highlighting escapes.
[05:02:50] <CIA-49> python-doctools: georg.brandl * r66486 /doctools/converter/converter/restwriter.py: Don't wrap URL text.
[05:40:40] * davidcramer has joined #pocoo
[06:31:05] * rawb has quit IRC
[07:17:21] <mitsuhiko> davidcramer: there is external bytecode cache support in jinja2 now
[07:17:29] <mitsuhiko> which solves that problem
[07:17:35] <davidcramer> oh sorry i missed anything else you said
[07:17:44] <davidcramer> so the issue was with jinja2 then?
[07:18:47] <mitsuhiko> actually no, you would have the same problem with django too
[07:19:00] <mitsuhiko> it's just less dramatical now
[07:19:15] <mitsuhiko> it's never an über clever idea to make the first request so complex that it takes two seconds
[07:19:51] <davidcramer> what was actually the problem?
[07:21:46] <mitsuhiko> that if you have the situation that you have a template that extends another two and that includes four templates leads to 7 templates that are all compiled on first request
[07:21:55] <mitsuhiko> which can take its time
[07:22:03] <davidcramer> ah
[07:22:12] <davidcramer> i only extend one
[07:22:19] <davidcramer> and typically no more than 1 include
[07:22:21] <mitsuhiko> http://jinja.pocoo.org/2/documentation/api#bytecode-cache
[07:22:26] <mitsuhiko> but this helps now for such situations
[07:22:45] <mitsuhiko> (actually. it generally should help a bit)
[07:22:52] <davidcramer> at first i thought it mighta just been sql issues on it
[07:22:54] <davidcramer> i saw 122 queries in the cprofile output
[07:23:06] <davidcramer> but w/ the prof call count i figured it wasnt
[07:29:52] <mitsuhiko> i've seriously underestimated the effects of a bytecode cache
[07:29:56] <mitsuhiko> should have been part of 2.0 already
[07:30:31] <davidcramer> ahh is __html__ the way jinja handles stripping of objects?
[07:30:33] <davidcramer> err escaping
[07:30:44] <mitsuhiko> not only jinja
[07:30:51] <mitsuhiko> and someone should implement that for django too
[07:31:14] <mitsuhiko> http://code.djangoproject.com/ticket/7261
[07:31:47] <davidcramer> you know iw as thinking earlier
[07:31:55] <davidcramer> if django's argument for its ugly ass if statements is "designer friendly"
[07:32:01] <davidcramer> then wouldn't it be "if 1 equals 2"
[07:43:18] <mitsuhiko> {% ifnotequals foo 2 %}...{% endifnotequal %}
[07:43:22] <mitsuhiko> \o/
[07:43:25] <mitsuhiko> so. off now. cya
[09:19:21] * ckknight has quit IRC
[09:28:45] * ckknight has joined #pocoo
[10:02:43] * leche has joined #pocoo
[10:07:57] * jinks has quit IRC
[10:09:01] * maxua has joined #pocoo
[10:09:11] * jinks has joined #pocoo
[10:09:22] <maxua> anyone running jinja2 on google appengine?
[10:44:36] <aa_> maxua: I have done
[10:45:15] <maxua> ok, i got it working too
[10:45:33] <maxua> there was os.remove import in bbacche
[10:45:38] <maxua> bbcache
[11:12:37] * harnak has joined #pocoo
[11:16:30] * jinks has quit IRC
[11:16:31] * prencher has quit IRC
[11:16:31] * empty has quit IRC
[11:16:31] * pjenvey has quit IRC
[11:16:31] * xorAxAx has quit IRC
[11:20:02] * xorAxAx has joined #pocoo
[11:21:05] * jinks has joined #pocoo
[11:21:06] * prencher has joined #pocoo
[11:21:06] * empty has joined #pocoo
[11:21:06] * pjenvey has joined #pocoo
[11:22:01] * pjenvey has quit IRC
[11:22:09] * pjenvey has joined #pocoo
[11:27:10] * maxua has quit IRC
[11:37:01] <dennda> Ahahaha: http://www.heise.de/newsticker/Sarah-Palins-E-Mail-Account-wurde-gehackt--/meldung/116129
[11:37:12] <dennda> gov.palin@yahoo.com
[11:37:20] * dennda bangs head against wall
[12:11:33] * davidcramer has left #pocoo
[12:12:02] * saptah has joined #pocoo
[12:12:03] <saptah> hi.
[12:28:40] <birkenfeld> hi!
[12:46:36] * grumpy has joined #pocoo
[13:29:11] * grumpy has quit IRC
[13:30:00] * grumpy has joined #pocoo
[13:38:29] * highwaychile has joined #pocoo
[14:19:04] * highwaychile has quit IRC
[14:25:56] * sebner has quit IRC
[14:37:28] * grumpy has quit IRC
[14:38:19] * harnak has quit IRC
[14:38:57] * harnak has joined #pocoo
[14:51:29] * maix has joined #pocoo
[15:26:38] * stifal has joined #pocoo
[15:29:50] * harnak has quit IRC
[15:30:23] * harnak has joined #pocoo
[16:12:17] * EnTeQuAk has joined #pocoo
[16:14:52] * EnTeQuAk has quit IRC
[16:23:58] <CIA-49> Jinja 2: Max Ischenko <ischenko@gmail.com> trunk * 575:7493010a0fb4 /jinja2/bccache.py: moved os.remove import where it woudn't be noticed by GAE
[16:28:57] * Kaelten has joined #pocoo
[16:47:13] * asmodai waves at Kaelten
[16:50:35] <Kaelten> heya asmo
[16:53:38] * ckknight has quit IRC
[16:55:15] <plaes> haha.. # don't ask....
[17:02:34] * maix_ has joined #pocoo
[17:03:01] * ckknight has joined #pocoo
[17:18:18] * maix has quit IRC
[17:20:56] * sebner has joined #pocoo
[17:37:33] * rawb has joined #pocoo
[17:38:35] * harnak has quit IRC
[18:05:19] * nosklo has joined #pocoo
[18:08:35] <nosklo> I am trying to create a jinja2 extension, that saves a block and only renders it if it has changed. I need to store some data which is pertinent to the current render of the template. Where can I store this data?
[18:08:48] <nosklo> Here is an example of what I am trying to accomplish: http://dpaste.com/78939
[18:09:30] <CIA-49> Jinja 2: mitsuhiko trunk * 576:8572e4bf5b82 / (4 files in 2 dirs): Fixed bytecode cache and added support for memcached (tests still missing)
[18:10:11] <mitsuhiko> nosklo: i don't think ifchanged is such a clever idea
[18:10:44] <mitsuhiko> i personally would try to group the data in the controller accordingly already
[18:10:55] <nosklo> mitsuhiko, any reason not to use it?
[18:11:04] <mitsuhiko> and then {% for month in months %}...{% for day, message in months.entries %}...
[18:11:26] <mitsuhiko> nosklo: ifchanged like django implements it will be very slow
[18:11:47] <mitsuhiko> because you have to buffer that data and keep it in memory for comparison
[18:12:53] <mitsuhiko> or you could implement it as filtering function
[18:13:20] <mitsuhiko> but either way, ifchanged doesn't seem right to me
[18:17:36] <nosklo> mitsuhiko, as a filter function, I can use a callable object instance and save it in the instance. But, do you think that would be a performance hit, to save a small snippet in memory?
[18:18:56] <mitsuhiko> i'll wire up a small extension of ifchanged and you can test it for yourself :)
[18:19:05] <mitsuhiko> it's just an assumption of mine
[18:23:53] <nosklo> mitsuhiko, that would be great
[18:24:04] <nosklo> mitsuhiko, since I am using it to learn about jinja2 internals
[18:32:30] <mitsuhiko> nosklo: http://paste.pocoo.org/show/85607
[18:32:44] <mitsuhiko> however. i don't recommend doing that :)
[18:33:08] <mitsuhiko> it's actually quite ugly to store the state in the template context but probably the cleanest implementation
[18:33:16] <mitsuhiko> actually not, i have something better. hold on a second
[18:36:40] <mitsuhiko> actually, screw that, it's probably the best thing for the moment
[18:38:34] * maix_ is now known as maix
[18:39:21] <CIA-49> Jinja 2: mitsuhiko trunk * 577:054d89683e51 / (CHANGES jinja2/runtime.py): It's now possible to create weak references to template contexts.
[18:39:33] <mitsuhiko> jinja 2.1 will support a cleaner implementation by using weak references :)
[18:43:58] <mitsuhiko> nosklo: http://paste.pocoo.org/show/85608
[18:44:01] <mitsuhiko> that one should work :)
[18:44:14] <mitsuhiko> i'm off now, if you need something, just write it here, i'll answer it later
[18:45:43] <mitsuhiko> oh. and the code won't work if more than one ifchanged is used in the same line, but that's fixable by using a better method to create the unique key :)
[18:59:05] * Tik-Tok has joined #pocoo
[19:06:29] <nosklo> mitsuhiko, sorry, I got called away, checking now...
[19:17:25] <mitsuhiko> nosklo: https://secure.wikileaks.org
[19:17:26] <mitsuhiko> gna
[19:17:41] <mitsuhiko> nosklo: http://paste.pocoo.org/show/85614
[19:17:44] <mitsuhiko> that's better :)
[19:17:47] <mitsuhiko> (untested though)
[19:19:05] <nosklo> mitsuhiko, cool
[19:19:25] <nosklo> mitsuhiko, It is the same I did, I just had a problem to know where to store the temporary dict
[19:19:54] <mitsuhiko> nosklo: in 2.1 the temporary dict can be stored in a weak reference to the context
[19:19:54] <mitsuhiko> which is a lot cleaner
[19:21:59] <mitsuhiko> nosklo: 2.1 version: http://paste.pocoo.org/show/85615
[19:28:21] <nosklo> mitsuhiko, is trunk 2.1?
[19:28:33] <mitsuhiko> yes
[19:28:42] <mitsuhiko> actually, it's called tip in mercurial :)
[19:29:43] <nosklo> mitsuhiko, great, I am using 2.1 then.
[19:31:23] * Baumichel has joined #pocoo
[19:31:29] <mitsuhiko> Kaelten: when upgrading to latest tip: FileSystemCache became FileSystemBytecodeCache now (which won't change)
[19:32:50] <nosklo> mitsuhiko, trying to understand.... the first version you were creating like a context variable in the extension, to store the block, using the name __ifchanged_lineno??
[19:33:41] <mitsuhiko> nosklo: which was not that clever. the parser has a free_identifier() which returns an unqiue identifier for a template
[19:33:48] <nosklo> mitsuhiko, if I create a context variable that starts with 2 underscores, it is not exported to the context? what is the magic?
[19:34:42] <mitsuhiko> nosklo: a) it's a bad idea to mess with context.vars, we don't support that
[19:34:51] <nosklo> mitsuhiko, yes, I know and agree
[19:34:57] <nosklo> mitsuhiko, it is just for learning purposes
[19:35:01] <mitsuhiko> now the two underscores mean nothing basically
[19:35:07] <mitsuhiko> one underscore in the template means: do not export
[19:35:14] <mitsuhiko> {% macro _foo() %}...{% endmacro %}
[19:35:26] <mitsuhiko> {% from 'macros.html' import _foo %} <- won't work
[19:35:49] <mitsuhiko> but that's something the compiler does
[19:36:09] <nosklo> mitsuhiko, ok, I got the first version sorted.
[19:36:22] <nosklo> mitsuhiko, where is this 'exported_vars' anyway?
[19:36:29] <mitsuhiko> context.exported_vars
[19:36:42] <mitsuhiko> it's a set of all names (that must be present in context.vars) that are exported
[19:36:53] <nosklo> ok. now in the second version I noticed you changed is None for is_undefined()
[19:37:13] <mitsuhiko> yes. is_undefined was an oversight
[19:37:25] <mitsuhiko> if you do context.resolve("var") you get undefined objects for not existing variables
[19:37:32] <mitsuhiko> but not so for context.vars.get("var")
[19:37:55] <mitsuhiko> if you want to understand how context object works internally, check out jinja2.runtime.Context
[19:38:33] <mitsuhiko> basically context.parent <- variables inherited from somewhere (either globals or passed to render()), context.vars are variables the template exports
[19:38:39] <mitsuhiko> exported variables are top level assignments
[19:38:50] <mitsuhiko> like a macro outside of a block or for loop or macro
[19:38:53] <mitsuhiko> or a set statement
[19:39:04] <mitsuhiko> {% set foo = "bar" %}{% macro bar() %}...{% endmacro %}
[19:39:08] <mitsuhiko> context.vars -> contains foo and bar
[19:39:15] <mitsuhiko> context.exported_vars contains foo an dbar
[19:39:17] <nosklo> understood
[19:39:37] <nosklo> now the free_identifier stuff
[19:39:45] <nosklo> does it create a sort of random name
[19:40:02] <mitsuhiko> exactly
[19:40:09] <mitsuhiko> it gives you an unique identifier for internal usage
[19:41:17] <mitsuhiko> id = parser.free_identifier(); [Assign(id, expr), Output([id])]
[19:41:25] <mitsuhiko> that's what you could do with it
[19:41:29] <mitsuhiko> if you only need the name you can do if.name
[19:41:37] <mitsuhiko> (like i did in the weakref example)
[19:41:54] <mitsuhiko> [god i suck at explaining things]
[19:42:00] <nosklo> no you are great
[19:42:17] <nosklo> or I am pretty good at understanding :)
[19:42:23] <mitsuhiko> i think the latter :)
[19:43:17] <mitsuhiko> nosklo: i recommend print env.compile("template code", raw=True) to see what's going on
[19:43:28] <nosklo> you use the entire context as key?
[19:43:50] <mitsuhiko> like this: http://paste.pocoo.org/show/85616/
[19:44:02] <mitsuhiko> nosklo: for the weakref dict? yep
[19:44:06] <mitsuhiko> that way it's cleaned up after rendering
[19:44:18] <mitsuhiko> and with 2.1 that's a supported operation
[19:45:23] <nosklo> it is pretty nice :)
[19:46:01] <mitsuhiko> (ignore the pass and if 0: yield None, they just exist for empty block handling and are removed by the python compiler)
[19:46:38] <mitsuhiko> so. off now
[19:46:43] <nosklo> my previous code is exactly like yours. But since I was using a dict in the env, it persisted between template renders :)
[19:46:47] <nosklo> mitsuhiko, thanks again.
[19:46:59] <mitsuhiko> you're welcome
[19:47:58] * nosklo has quit IRC
[19:48:13] * nosklo has joined #pocoo
[19:51:14] * nosklo has quit IRC
[20:06:13] <Kaelten> mitsuhiko: cool, so you cleaned up that code?
[20:08:15] * ckknight has quit IRC
[20:11:51] <empty> mitsuhiko: so did you see malcolmt's post on django-dev
[20:11:55] <empty> about your post.
[20:11:56] <empty> :P
[20:12:51] <prencher> empty - link?
[20:13:07] <empty> http://groups.google.com/group/django-developers/browse_frm/thread/4f5b01719e497325
[20:18:20] <prencher> i know malcom is a smart guy, but a good deal of that sounds more like he's talking out of passion
[20:22:00] <empty> yep
[20:28:47] <prencher> mitsuhiko - oh you added the bytecode caching thing i suggested? awesome
[20:29:45] <prencher> you been busy, we talked about that, what.. day before yesterday?
[20:31:50] <prencher> Kaelten - have you seen it?
[21:48:37] * stifal has quit IRC
[21:52:45] <Kaelten> prencher: yep, I have yesterdays version in production already
[21:52:48] <Kaelten> drastic improvements
[22:06:27] * highwaychile has joined #pocoo
[22:10:15] <prencher> Kaelten - a memcached one was added, not sure if you saw it
[22:10:24] <Kaelten> no i didn't it
[22:36:12] <mitsuhiko> empty: yeah. read it
[22:36:25] <mitsuhiko> i was hoping i could meet him on irc
[22:37:10] * davidcramer has joined #pocoo
[22:51:53] <empty> mitsuhiko: good luck, he's not on much. :)
[22:55:00] <mitsuhiko> email then :)
[22:55:28] <mitsuhiko> i don't want to end up being the bogeyman :)
[22:55:34] <empty> yah
[23:01:22] <mitsuhiko> empty: is malcolm the maintainer of the template system?
[23:01:54] <ivan> man you should just build the pocoo empire, frameworks are doomed ;)
[23:03:32] <empty> mitsuhiko: no, I don't think so.
[23:03:42] <empty> but malcolm is pretty much the uber maintainer of everything.
[23:04:03] <empty> look at V1 features and he had his hand in most of them.
[23:04:09] <mitsuhiko> i see
[23:04:23] <mitsuhiko> ivan: django is not bad (even if ronny will tell you it is)
[23:04:34] <mitsuhiko> they just have a few things where things have to be changed
[23:05:01] <ivan> my main problem with it is actually the mode-full administration
[23:05:20] <ivan> things should somehow seamlessly integrate with the user's view
[23:05:24] <mitsuhiko> empty: is it possible to reconfigure django?
[23:05:38] <mitsuhiko> i can't import django.templatetags.i18n without configuration
[23:06:30] <empty> right you can't
[23:06:58] <empty> mitsuhiko: that's a huge problem and it's because the bootstrapping requires it
[23:17:20] <mitsuhiko> found a solution that works for me
[23:17:29] <mitsuhiko> django2jinja requires that django is configured now :)
[23:23:25] <empty> cool
[23:23:47] <mitsuhiko> crap. FilterExpression is not fully convert-able to jinja because django drops important information too early
[23:23:52] <mitsuhiko> i think i found another django bug
[23:24:20] <mitsuhiko> {{ foo|filter:_("bar") }} will be translated once (when the template is compiled)
[23:24:30] <mitsuhiko> if however the language changes from request to request no retranslation happens
[23:25:27] * maix has quit IRC
[23:27:54] <mitsuhiko> yes. broken :-/
[23:31:40] <mitsuhiko> holy cow
[23:32:14] * mitsuhiko quickly closes django.utils.translation again
[23:38:47] <mitsuhiko> prencher: were you complaining about #django hating thread locals and that they don't work?
[23:38:54] <mitsuhiko> guess what the i18n system is using (surprise)
[23:40:01] <davidcramer> lol
[23:40:04] <davidcramer> why would it use that
[23:40:16] <davidcramer> i actually use threadlocals in our site
[23:40:22] <davidcramer> i fucking *hate* not having access to the request everywhere
[23:40:28] <davidcramer> so all I do is make that sort-of globally available
[23:40:29] <mitsuhiko> because nobody wants to write request.gettext() :)
[23:41:01] <mitsuhiko> and another django bug
[23:41:04] <mitsuhiko> empty: ping
[23:41:47] <davidcramer> mitsuhiko: see the comment on my blog about mixin.com ?
[23:41:57] <davidcramer> they switched their main page from django to jinja and immediately saw a 60% improvement
[23:42:00] <davidcramer> err
[23:42:12] <davidcramer> 60% cant be right bu
[23:42:16] <davidcramer> 1000ms -> 400ms
[23:43:15] <mitsuhiko> i think that comment was actually in my blog ;)
[23:43:25] <davidcramer> oh maybe they crossposted
[23:44:51] <mitsuhiko> i would be really interested to see the difference between django and jinja on a real-world application that uses few custom tags
[23:44:51] <ronny> hehe
[23:45:13] <mitsuhiko> maybe someone knows a good open source project that uses few custom tags
[23:45:21] <mitsuhiko> should be easy to translate and give a fair comparison
[23:47:00] <mitsuhiko> and another django bug
[23:47:04] <mitsuhiko> three in one hour
[23:47:07] <mitsuhiko> (django template engine)
[23:47:15] <mitsuhiko> now it becomes ridiculous
[23:47:35] <mitsuhiko> the i18n handling in templates is totally breakage, why has nobody noticed so far?
[23:47:40] <davidcramer> django-tagging
[23:47:43] <davidcramer> i think it has some
[23:47:48] <davidcramer> fairly useless IMO but they're there
[23:48:12] <davidcramer> ive never used django's i18n stuff
[23:48:18] <davidcramer> we rolled our own at Curse (though I'm not sure why now)
[23:50:27] <CIA-49> Jinja 2: mitsuhiko trunk * 578:8fd36023dd7d /ext/django2jinja/ (django2jinja.py example.py templates/index.html): Added i18n support to django2jinja (not complete support, but the best you can get before django fixes a bug in i18n handling)
[23:53:42] * highwaychile has quit IRC