Hopbot log for 2008-01-28 - Helma IRC channel: #helma on irc.freenode.net

2008-01-28:

[10:14] <pek> anyone here?
[10:14] <zumbrunn> hi pek
[10:15] <pek> hi, care to help a helma newbie?
[10:15] <zumbrunn> sure :-)
[10:16] <pek> hehe, perf. i'm stumbling around in the maze of mappings/routings/urls
[10:18] <pek> First, what I try to achieve, is to create an url like this: /appname/entry/filename
[10:18] <zumbrunn> with filename being a static file?
[10:19] <pek> no, filename is a db field in the entry table
[10:19] <zumbrunn> ok
[10:20] <pek> i can output a list of entries just fine
[10:20] <pek> but the href_macro in entry/macros.js outputs ""
[10:22] <pek> it's probably something wrong in /entry/type.properties, but I cant figure out what.
[10:23] <pek> this.href() => ""
[10:25] <pek> I don't really understand what parameter the href function uses to create the url, I thought it was /proto/_id/action - but I get blank.
[10:27] * zumbrunn is on the phone right now
[10:27] <pek> np, I'm just rambling along :)
[10:27] <pek> I've mapped (in /root/type.properties) entry = mountpoint(Entry)
[10:28] <pek> wow. shaky irc client
[10:29] <zumbrunn> I'm not sure how to best help with this anyway
[10:29] <zumbrunn> I pinged hannes to take a look and come and help
[10:30] <zumbrunn> he might come by in a sec
[10:30] <pek> thanks :)
[10:31] <pek> coffee, brb
[10:33] <zumbrunn> did you set a _parent property in type.properties?
[10:36] <pek> yep, /blog has _parent = root, entry has _parent = root.blog
[10:37] <zumbrunn> _parent is what controls how this.href() is resolved
[10:37] <pek> yes, I figured out that much :)
[10:37] <pek> but, now i see in the logs; Error: Can't retrieve parent node ParentInfo[root.blog] for [object Entry]
[10:39] <pek> I also tried _parent = blog and added blog as an object property in entry, but no luck
[10:39] <pek> im lying, that works :)
[10:46] <pek> well, almost. I wanted /entry/filename, but got /blog/filename - damn, I never cared much for this url routing stuff, rails no exception.
[10:50] <pek> do I have to define entry = mountpoint(Entry) anywhere else than in /root/type.properties ?
[10:59] <zumbrunn> if the _parent entry for blog is root, aren't you looking for a /appname/blog/entry/filename url structure then?
[11:02] <pek> That's what i was trying to avoid. I thought mapping "entry" in roots type.properties could give me /appname/entry/filename
[11:58] <pek> ok, a little progress now :) /appname/<blogname>/<filename>/ works. One strange thing is that i can get a <filename> that doesn't belong to <blogname> if i change the blogname. But it throws if i change to a blogname that doesn't exist. Any tips on how to check/restrict that I only can acces a filename that belongs to the blogname ?
[11:59] <pek> http://my.domain/blog1/entry-of-blog1/ vs. http://my.domain/blog2/entry-of-blog1/
[12:00] <pek> but http://my.domain/blog3/entry-of-blog1/ fails if blog3 doesn't exist.
[13:11] <midnightmonster> blog.properties (or blog's type.properties) should say:
[13:11] <midnightmonster> _children = collection(Entry)
[13:11] <midnightmonster> _children.local = BLOG_ID
[13:11] <midnightmonster> _children.foreign = BLOG_ID
[13:11] <midnightmonster> assuming blog_id is the right column name in both your blogs table and your entries table
[13:13] <midnightmonster> If you want more than one blog depending on DB table contents and more than one entry depending on DB table contents, you what to use collection(PrototypeName) for both--no mountpoint() stuff. Mountpoint attaches a single object *not* from the DB to a given object.
[13:13] <pek> ah, thanks, I only had assigned foreign
[13:13] <midnightmonster> check out http://helma.org/docs/guide/mapping/, esp. http://helma.org/docs/guide/mapping/collections/
[13:13] <midnightmonster> gtg now. good luck
[13:14] <pek> thx, later
[14:08] <zumbrunn> midnightmoster, aren't you confusing mountpoint() and object() mappings?
[14:09] <zumbrunn> object() mounts a single object
[14:09] <zumbrunn> mountpoint() mounts all objects of a certain prototype
[14:39] <midnightmonster> zumbrunn, I think you're mistaken
[14:40] <midnightmonster> (I hesitate to say so, since the documentation is hosted on your server, for Pete's sake)
[14:41] <zumbrunn> well, not *that* documentation ;-)
[14:41] <midnightmonster> object() is a placeholder to attach or not attach a single object, and (I believe) it can be done through the DB--like collections but for a single object. but if blog.properties has foo = mountpoint(Entry)...
[14:41] <zumbrunn> that's the part of helma that I'm not using myself
[14:42] <zumbrunn> so, that's why I'm not much help in that area either
[14:42] <midnightmonster> then /any_blog/foo is a single Entry object
[14:42] <midnightmonster> and whenever you create a blog object, it gets a foo automatically
[14:43] <midnightmonster> object() is there b/c sometimes you really just want one item instead of a collection(), but it works the same way. mountpoint() is there so you can stick your own management-type objects into the path chain even if they have no db correspondence
[14:44] <midnightmonster> (I actually have used all three in one project, and their actual behavior matches the understanding I ended up with of their nature/function.)
[14:46] <zumbrunn> I thought that for example a users = mountpoint(User) in Root.properties would mount user objects at appname/users/username
[14:46] <midnightmonster> nope
[14:46] <midnightmonster> not that I've found
[14:46] <zumbrunn> or appname/users/userid
[14:46] <zumbrunn> ok, then I got that totally wrong
[14:46] <midnightmonster> users = collection(User)
[14:47] <midnightmonster> I didn't play enough with users to see if there were more ways than I actually did to get them to show up in the url tree
[14:48] <midnightmonster> users = mountpoint(User) should just mean that there a single User at /users
[14:49] <zumbrunn> then the following is wrong?...
[14:49] <zumbrunn> http://helma.org/docs/guide/mapping/mountpoint/
[14:49] <midnightmonster> here's my root.properties on preachingtheword.net:
[14:49] <midnightmonster> users = mountpoint(UserMgr)
[14:49] <midnightmonster> sermons = mountpoint(SermonMgr)
[14:49] <midnightmonster> ot = mountpoint(BookList)
[14:49] <midnightmonster> nt = mountpoint(BookList)
[14:49] <midnightmonster> guestbook = mountpoint(Guestbook)
[14:49] <midnightmonster> topics = mountpoint(TopicList)
[14:50] <midnightmonster> yeah. afaict, that's wrong
[14:50] <midnightmonster> I can test, though
[14:51] <midnightmonster> 'cause as you can see, /nt and /ot are each mountpoint(BookList)
[14:52] <midnightmonster> http://preachingtheword.net/nt http://preachingtheword.net/ot
[14:52] <midnightmonster> ^ obviously, they're different BookLists
[14:52] <midnightmonster> and if you do http://preachingtheword.net/nt/2 or http://preachingtheword.net/nt/3 (2 and 3 are the actual _id's of those), you get Not Found
[14:54] <midnightmonster> the doc link you gave pretty much describes collection(), not mountpoint().
[14:55] <midnightmonster> maybe if you mountpoint() a proto that has a DB mapping, helma treats it like collection() ? I don't know, 'cause I did this all with the object DB
[14:55] <midnightmonster> and unfortunately I've gtg again
[14:58] <zumbrunn> hmm
[15:18] <pek> got it working now
[15:18] <pek> struggling with jk + apache :)
[15:20] <pek> trying to work around > 1 apps "mounted" as "/"
[15:21] <pek> this.href() returns "appname" - that's not too cool when executed by apa + jk, i want it to drop the appname.
[15:21] <pek> same problem you always run into on tomcat setups. only one context can be root.
[15:23] <zumbrunn> mod_proxy often makes for a good alternative to using mod_jk, btw
[15:24] <zumbrunn> it's easier to setup/configure
[15:26] <zumbrunn> for example:
[15:26] <zumbrunn> <VirtualHost 192.168.0.10>
[15:26] <zumbrunn> ServerName www.foodomain.tld
[15:26] <zumbrunn> ServerAdmin admin@foodomain.tld
[15:26] <zumbrunn> ProxyPass / ajp://localhost:8009/fooapp/
[15:26] <zumbrunn> </VirtualHost>
[15:27] <pek> I've got quite a good grip on jk after hours struggling with that earlier, so its running perfect now against helma.
[15:28] <pek> its just that helma doesn't know that i want "/" as my baseuri, not "appname" - and i can only configure one app mounted as "/"
[15:29] <pek> guess I have to override href() to strip out "appname/"
[15:31] <pek> baseuri did the trick... next :)
[17:19] <hypersmil> pek: baseuri
[18:16] <pek> somehow I always have to work some mod_rewrite magic, so the whole routing/mapping shabang in frameworks just complicates stuff for me ;) I know it's possible to initiate, load etc. objects manually, but it just feels. wrong. Same story in rails, django, pylons, cake whatever. But we do the best we do :)
[18:18] <zumbrunn> because of the mountpoint thing that didn't work?
[18:18] <pek> especially if its mapped to some ui/view magic. writing functions to spit out hrefs feels weird. BUT, i've tried all the most popular frameworks for php, python + rails, and helma _feels_ good.
[18:18] <pek> nono
[18:18] <zumbrunn> or did you figure that one out?
[18:18] <pek> just a general observation. mapping is always the biggest hurdle (for me) when trying out a framework. And that I think affects the adoption rate.
[18:19] <pek> i gigured it out
[18:19] <pek> +f
[18:19] <pek> all is golden now
[18:19] <zumbrunn> so, what was it that tripped you up?
[18:19] <zumbrunn> or did you end up going with the /appname/blog/entry/ url structure and avoid mountpoint()?
[18:21] <pek> yes, but I had to hack the url in mod_rewrite to make it the way i wanted.
[18:21] <midnightmonster> hmmm. I'm willing to bet there's a non-mod_Rewrite way to do it
[18:21] <zumbrunn> right, me too
[18:22] <pek> http://<subdomain>.myapp.com/anything => /myapp/<subdomain>/anything
[18:22] <midnightmonster> said as a padawan mod_rewrite wizard, myself.
[18:22] <midnightmonster> fair. it could be done in code, but easier to do with mod_Rewrite
[18:22] <pek> and pass over to mod_jk
[18:25] <midnightmonster> using mod_proxy with ajp protocol (don't know about otherwise, assume mod_jk provides similar) you can read the host name and you could use it for a custom getChildElement to do that in Helma, but I might be inclined to do it with mod_Rewrite, too
[18:25] <pek> http://pek.myapp.com/2008/01/27/first_entry => http://localhost:8080/myapp/pek/first_entry
[18:26] <midnightmonster> so you're overriding href as well, then?
[18:26] <midnightmonster> .href()
[18:26] <pek> yep, had to do that
[18:26] <pek> entry.href() returns subdomain (blogname)
[18:27] <midnightmonster> this is the start of how you can do that sort of thing in Helma: http://helma.org/docs/examples/getChildElement/
[18:27] <pek> entry.href() becomes http://pek.myapp.com/pek/first_entry/
[18:28] <pek> mhm, I was about to look into that
[18:28] <midnightmonster> hrm. I still smell kludge. if you've got time to play with it, I think you might want to play with it some more.
[18:28] <midnightmonster> adieu again
[18:36] <pek> so, documentation-wise, what's most needed?
[18:38] <zumbrunn> type.properties is the black hole in the docs, I think
[18:39] <zumbrunn> what we need is an actual "reference" for that part of the framework
[18:39] <zumbrunn> what we have right now is more like examples and an overview
[18:40] <zumbrunn> that's where people seem to get tripped up the most
[18:40] <pek> ok, I always doc stuff when I learn new things. Might put it to good use

 

 

In the channel now:

Logs by date: