#turbogears - Archive for 09 August, 2006

#turbogears on Freenode

Archive for 09 August, 2006

09 August 2006
03:45 DraX: can one not use %(top_level_dir) with old style dev/prod.cfg ?
04:42 atwork: i have a strange problem with tg0.9.6+and sqlobject0.8. if i update the model, i sometimes still get the old values which has been changed. sqlite has stored the values correctly, but what is retrieved by ModelObject.get(1) varies randomly between the old and the new values.
08:10 Handful: hi people! Does anyone here has deployed a turbogears app using apache? I just wanted to clear up one doubt about URLs in that enviroment .. :/
08:21 splee: god damn colloquy.
08:22 splee seriously considers switching back to irssi
08:52 atwork: any documentation how to migrate from sqlobject to sqlalchemy?
08:52 splee: atwork: not that I'm aware of.
08:53 splee: atwork: I would just quickstart with sqlalchemy and look at the differences.
08:56 splee: atwork: documentation is currently the biggest bug with turbogears, so if you feel like writing up what you find out (if you go through the process) it would be much appreciated.
08:59 atwork: splee: thanks. i managed to get something working. i'll write a post into my "from java to python"-blog when i've managed to get all working (http://atwork.wordpress.com/) . there seems to be no shortcuts for the longer syntax. sqlobject: Project.get(id) , sqlalchemy: session.get(Project, id)...
09:00 splee: is that blog entirely turbogears related?
09:01 atwork: splee: it
09:01 splee: if so, are you happy for it to be added to planet.turbogears.org?
09:04 jtate: splee: I'm going to blog a little bit about turbogears, I could make a feed that would only be turbogears related if you want to aggregate it.
09:04 splee: jtate: that would be great. I'm always looking for new feeds to add to the planet.
09:04 atwork: splee: just a sec, i'll just change the category for tg-related posts
09:04 splee: atwork: excellent, thanks.
09:04 jtate: splee: hang on a sec
09:06 atwork: splee: it's my diary about trying out turbogears, and comparing it to web-frameworks for java that i've used for many years.
09:06 atwork: splee: it's not an instructable blog
09:07 splee: atwork: that doesn't matter. it's about turbogears :)
09:07 jtate: splee: http://www.dragonstrider.com/serendipity/index.php?/feeds/categories/18-Turbogears.rss
09:08 jtate: Nothing there yet
09:08 jtate: The link to my main blog can either be http://www.dragonstrider.com/serendipity/index.php?/categories/9-Josephs-Musings or http://www.dragonstrider.com/serendipity/index.php?/categories/18-Turbogears
09:08 jtate: the first is my main category, the latter is just the turbogears category
09:08 splee: jtate: what do you want me to put as the name?
09:09 arnal: hey
09:09 splee: ah, joseph tate.
09:09 jtate: :)
09:09 arnal: i wonder why i have the following js error : elem has no properties (tg_js/Mochikit.js) ?
09:10 arnal: i have just used the turbotunes example in my project
09:12 atwork: splee: https://atwork.wordpress.com/?cat=33610
09:13 atwork: arnal: i got the same error last week. hold on.
09:15 atwork: arnal: i did the ajax-part from this tutorial: http://exogen.case.edu/turbogears.html . i removed the line <span>${item.value}</span> after the <input type="button"... and i get the error
09:15 arnal: atwork: thanks, i'm trying that
09:16 atwork: arnal: in this case the value between the <span>-tags goes into onclick="editItem(this)" (depending on the javascript)
09:17 jtate: splee: the link for my blog is http://planet.turbogears.org/None does that take a while to take effect?
09:18 splee: no, i was just looking into that.
09:21 splee: jtate: something's up with planet... it's not picking up the link from your feed.
09:22 splee: jtate: and your feed looks well formed so I'm not sure what's occuring.
09:22 splee: jtate: i'll get on it later. I've gotta get to work now.
09:23 elvelind: splee: time to start coding on turboplanet? ;)
09:23 jtate: ok. I think this is a problem we had to patch on planet.conary.com too
09:23 splee: elvelind: lol... I was just thinking the same thing.
09:23 elvelind: splee: It's actually on my todo list for tonight :)
09:24 splee: jtate: well, if you have the details of the patch it would be appreciated. :)
09:24 splee: elvelind: if you do set up the project, mind if I help out?
09:24 elvelind: well. time to go out and take a walk
09:24 elvelind: splee: not at all.
09:25 splee: elvelind: cool. enjoy your walk. I'm headed to the office.
09:25 splee: catch y'all later.
10:18 SteveA: atwork: I'm interested... why do you want to migrate from sqlobject to sqlalchemy?
10:23 atwork: SteveA: because I got the image that sqlalchemy is better :)
10:23 SteveA: why would I choose sqlalchemy over sqlobject?
10:23 SteveA: is one being more actively developed?
10:24 atwork: SteveA: now i see that sqlobject is much easier to work with, but i have to try it out completely since i started to investigate sqlalchemy.
10:25 SteveA: any particular features that attract you in either of them?
10:25 SteveA: I'm using sqlobject on a project and I'm interested in what makes a good ORM library
10:25 atwork: SteveA: sqlalchemy looks like hibernate for java. it's more complex. i got weird problems with sqlobject, and didn't get any answer to my question, so i started looking at sqlalchemy. no particualr feature.
10:26 SteveA: on my project, we've added a function call that clears the whole sqlobject object cache
10:26 SteveA: to make sure there won't be old objects hanging around between transactions
10:27 atwork: SteveA: damn! that's sounds exactly like the problem i had with it:
10:27 atwork: i have a strange problem with tg0.9.6+and sqlobject0.8. if i update the model, i sometimes still get the old values which has been changed. sqlite has stored the values correctly, but what is retrieved by ModelObject.get(1) varies randomly between the old and the new values.
10:27 SteveA: are you using multiple threads with sqlobject?
10:28 Arnar: SteveA: what makes a good ORM to me is the ability to seperate table definition/structure from my classes..
10:28 Arnar: which is why I like SQLAlchemy
10:28 Arnar: I have alot of customization (spelling?) points on the mappers, but common things are still easy and simple
10:28 SteveA: Arnar: does that help with maintaining your code?
10:29 atwork: SteveA: multiple tgthreads( server.thread_pool: 10), but i'm only running with one user and get these problems.
10:29 Arnar: SteveA: yes, it allows me to design my database the way I think it should be (not they way the ORM thinks it should be) which makes the db easier to use from other apps
10:30 Arnar: SteveA: I haven't worked much with SQLObject, but they way it restricts you for example to single-column integer primary keys is one reason why I stear clear of it
10:31 SteveA: atwork: I suggest totally clearing the cache for the current thread between transactions
10:31 atwork: SteveA: depends on how simple your project is. More flexibility means more complexity.
10:31 atwork: SteveA: do you have the code?
10:32 atwork: SteveA: isn't there a way to disable the cache if it doesn't work?
10:33 SteveA: I'll take a look...
10:33 Arnar: SteveA: I haven't used hibernate either, except when I was evaluating java orms a while ago. Hibernate was young then and I ended up using Apache ObjectRelationalBridge - which I liked very much (don't do much Java programming anymore)
10:35 atwork: Arnar: ORB is dead nowadays. ibatis is very nice for java also.
10:35 SteveA: atwork: something like:
10:35 SteveA: for cache in SQLObjectBaseClass._connection.cache.allSubCaches():
10:35 SteveA: cache.clear()
10:35 SteveA:
10:36 SteveA: I'm using a specialized baseclass and a slightly altered sqlobject, so you'll have to work out exactly what you need to do for your own situation.
10:36 atwork: SteveA: thanks, i'll try that
10:41 jtate: splee: you could try this patch, but I'm not 100% sure if that's what fixed the issue for us. http://pastebin.ca/123678
10:43 splee: jtate: cool, thanks. I'll take a look.
10:45 martii: hi I have a question about sqlobject
10:47 arnal: i'm trying to hide some element with the class 'secondFlagField' in my webpage, i have written that : http://paste.debian.net/10530, however it isn't hidden at all
10:47 arnal: any idea ?
10:48 martii: I pass query via sqlobject and it appends ID to the end of table name and uses it as WHERE statement
10:49 martii: is there any way I could get rid of that?
10:51 jtate: arnal: I use display: none instead of hidden for most DOM elements
10:51 jtate: alter between display: none and display: block
11:04 arnal: jtate: i would like to hide td elements actually
11:05 arnal: jtate: at the moment, i have a blank where the column should be hidden
11:05 arnal: jtate: it works fine with display, thanks a lot
11:08 jtate: inter table hiding/displaying is tricksy, and error-prone
11:08 arnal: jtate: do you know how to simplify that :
11:08 arnal: setElementClass(elem[0], 'displayHidden');
11:08 arnal: setElementClass(elem[1], 'displayHidden');
11:08 jtate: arnal: not really
11:17 arnal: i dunno how to use forEach
11:19 jtate: you can do for (var in [0, 1]) {}
11:19 arnal: thanks
11:23 arnal: it doesn't work :/
11:24 arnal: i did : for (e in elem) { setElementClass(e, 'displayHidden'); }
11:26 jtate: :)
11:27 arnal: what is the problem ? :)
11:31 Arnar: arnal: are you using mochikit?
11:31 arnal: yes
11:32 volvox suggests "for each", The Definitive Javascript Guide by O'Reilly, and Firebug :-)
11:32 Arnar: what is elem ?
11:33 arnal: Arnar: var elem = getElementsByTagAndClassName(null, 'secondFlagField');
11:33 arnal: volvox: ;)
11:34 Arnar: does this work: map(partial(setElementClass, 'displayHidden'), elem) ?
11:35 Arnar: no sorry..
11:35 Arnar slaps himself
11:35 Arnar: that would call setElementClass with the wrong parameter order
11:36 Arnar: for (x in o) is supposed to loop over object properties... looping over arrays loops over it's indexes
11:36 Arnar: "for (x in [1,2,3]) alert(x)" gives the sequence 0, 1 and 2
11:36 jtate does not claim javascript proficiency
11:37 Arnar: replace [1,2,3] with whatever 3-element list you like, it always gives 0,1 and 2
11:37 Arnar: javascripts "for each" construct is unintuitive at the best...
11:38 Arnar: this should work: for (e in elem) { setElementClass(elem[e], 'displayHidden'); }
11:41 arnal: Arnar: i try, thanks
11:42 arnal: Arnar: it works
11:42 volvox: yes, better to stick to the indices until they properly implement iterators in JS 1.7 :-)
11:42 arnal: thanks Arnar and jtate
11:43 arnal: i have another question (sorry to bother you with that ;)) : http://paste.debian.net/10536
11:44 arnal: even when options is empty, sometimes, it isn't hidden, any idea ?
11:54 Arnar: arnal: which side of the if..else is executed?
12:32 rodelrod: Hi. I'm just beginning with turbogears
12:33 rodelrod: and when I call tg-admin shell, IPython is picked up (nice touch) but the imports are not being made
12:35 rodelrod: is there a way to configure tg-admin shell?
12:41 T`ch: hey guys
12:41 T`ch: anyone use sqlobject for thier production site?
12:42 T`ch: i keep getting "mysql server went away" if i idle the server to too long (like all night)
12:51 Airwulf: Hello to you all
12:51 Airwulf: is there a tree widget for turbogears? I found none with google
12:56 stickystyle: Airwulf: like this -> http://www.treemenu.net/ I am not aware of any pre-made widgets for that yet.
13:09 idiotern1: er. how do i select max(stuff) from somewhere using sqlobject?
13:09 idiotern1: i remember a dirty way, but not verbatim, and can't find it in the docs :P
13:25 stain: I used dtree, it looks like this: http://soiland.no/mygridontology/
13:25 stain: and it was easy, you just need to write say
13:25 stain: d.add(9, 8, 'secondary_structure_prediction', '#')
13:25 stain: and connt node 9 to 8 etc.
14:10 Handful: Hi, does anyone has faced the need for images (like bg-images ) on CSS, but your site must use tg.url() to generate the absolute urls?
14:10 Handful: is there a way to solve this without having to process the css?
14:12 mrshoe: Handful: would using a template to generate the css work?
14:15 jtate: Handful: I use relative urls in css files
14:15 jtate: and the nice thing is that the urls in css files are relative to the path for the css file, so usually you can use "../images/foo.png"
14:40 Handful: jtate, unm nice.. I said that here in the office but the guy behind the controller code said it was not relative
14:42 Handful: jtate, thanks I will try it out..
14:42 jtate: so you have two different things here
14:42 Handful: jtate, and for the external javascript ? in your js file.. you need to call some url...
14:42 jtate: in an html page loaded, a relative path is relative to the url in the browser bar
14:42 Handful: how do you manage that?
14:42 jtate: in a css file however, a url is relative to the path of the loaded css.
14:43 jtate: for js, it's a kludge
14:43 jtate: <script type="text/javascript">
14:43 Handful: : / for now.. I'm using a script in the .kid template just to get the "base_url" var..
14:43 jtate: var relpath = ${tg.url(/)}
14:43 Handful: and use this var inside every function that needs linking...
14:43 jtate: </script>
14:43 Handful: oh yeah.. so that's the way : /
14:43 jtate: precisely
14:44 jtate: kludgey
14:44 Handful: well, nice... I will fix things around here..
14:45 Handful: thnx jtate
14:45 jtate: you're welcome
17:48 s0undt3ch: hello ppl
17:54 s0undt3ch: I'm wondering if django is the framework for my current needs, which are:
17:54 s0undt3ch: webapp delivery trough at least cgi but preferably mod_python
17:54 s0undt3ch: I won't use any db backend
17:54 s0undt3ch: I'll need authentication and sessions
17:55 s0undt3ch: all dynamic content will be fetched from LDAP
17:55 s0undt3ch: errrr
17:55 s0undt3ch: sorry
17:55 s0undt3ch: s/django/turbogears/ :)
17:56 s0undt3ch: some templating, preferably cheetah
17:57 s0undt3ch: easy deployment
17:57 s0undt3ch: so, is tb suited for me?
17:59 mrshoe: s0undt3ch: i think it would work well for you
18:00 s0undt3ch: so, I won't *need* a normal db backend(MySQL, Postgres) for something like sessions, right?
18:01 mrshoe: s0undt3ch: i'm not too familiar with tg sessions, but i'm pretty sure there are options
18:01 mrshoe: i've never used the db as a session store.. used to use memcached, now i use pear
18:02 s0undt3ch: that's what got me away from django for example, webware seems pretty easy to work with, but lacks a users base, seems nobody is using it
18:02 s0undt3ch: mrshoe: pear? PHP pear?
18:02 mrshoe: no python pear
18:03 s0undt3ch: what's that backend? file based?
18:04 mrshoe: http://cheeseshop.python.org/pypi/pear/0.8
18:04 mrshoe: memory
18:05 s0undt3ch: yep, seems suitable
18:05 s0undt3ch: you use CherryPy with that?
18:05 mrshoe: extremely fast, binds to a socket so you can load balance accross many web servers and they all share the same sessions
18:05 mrshoe: yeah it comes with a cherrypy adapter
18:05 s0undt3ch: guess, I need to try an approac on tg then
18:05 s0undt3ch: *approach
18:06 s0undt3ch: should I get stable? or 1.0 alpha, or svn for that matter?
18:07 s0undt3ch: oops, 0.9 alpha
18:08 mrshoe: not sure.. i don't use tg..
18:08 s0undt3ch: huh, you don't !? what do you use then?
18:08 s0undt3ch: no framework at all?
18:08 mrshoe: i do use cherrpy, cheetah, formencode
18:09 s0undt3ch: oh, you use them akk split up
18:09 s0undt3ch: *all
18:11 mrshoe: no i wrote my own framework before tg existed
18:12 s0undt3ch: hum, is it publicly available?
18:13 mrshoe: nah.. i imagine there are dozens of people who did the same thing.. probably better not to release it, too many web frameworks out there as it is
18:13 mrshoe: plus i don't want to document it, make a web site.. obligatory screencast, etc.
18:13 s0undt3ch: he he he
19:08 splee: quiet in here :)
22:16 mrshoe: everyone jumped ship.. they're in #sqlonrails
22:23 jtate: heh
23:51 Tmob: anyone know where turbogears stores its logs?
23:51 Tmob: i am running my server in production mode, but dont know where the logs are..

TurboGears under the hood