IRC log for #storm on 20090513

02:45.59*** join/#storm shaunm (n=shaunm@c-98-212-133-244.hsd1.il.comcast.net)
03:04.29*** join/#storm sidnei (n=sidnei@plone/dreamcatcher)
05:47.52*** join/#storm jukart (i=lovely@81.189.156.94)
06:37.53*** join/#storm akm1 (n=akm1@122.166.39.10)
08:48.58*** join/#storm goschtl (n=goschtl@p5B0BFB9D.dip.t-dialin.net)
10:12.54*** join/#storm andrea-bs (n=andrea@ubuntu/member/beeseek.developer.andrea-bs)
12:14.20*** join/#storm artista_frustrad (n=artista_@201-15-206-162.ctame704.dsl.brasiltelecom.net.br)
13:26.17*** join/#storm keppla (n=keppla@i577B2D44.versanet.de)
13:29.11*** part/#storm keppla (n=keppla@i577B2D44.versanet.de)
13:47.36*** join/#storm sidnei (n=sidnei@plone/dreamcatcher)
14:45.53*** join/#storm andrea-bs (n=andrea@ubuntu/member/beeseek.developer.andrea-bs)
15:28.52*** join/#storm benw1 (n=ben@c-98-232-16-38.hsd1.wa.comcast.net)
15:30.45benw1Can I define an instance method (row level) on a Storm model?  I keep getting a 'no store' error --
15:36.16*** join/#storm todogliu (n=gliu@adsl-69-236-79-150.dsl.pltn13.pacbell.net)
15:38.56*** part/#storm todogliu (n=gliu@adsl-69-236-79-150.dsl.pltn13.pacbell.net)
15:40.15*** join/#storm sidnei (n=sidnei@plone/dreamcatcher)
15:41.38thervebenw1: can you provide more details of your problem?
15:42.35benw1I'll paste an example
15:50.00*** join/#storm jukart (n=jukart@d91-128-122-124.cust.tele2.at)
16:00.58benw1Is there an efficient way to do this: http://dpaste.com/43717/
16:01.25benw1I'm talking specifically about the get_admin_{realms, roles} instance methods on the User class
16:03.23jkakarbenw1: Yes.
16:03.58jkakarbenw1: You can use the find method on the ReferenceSet.  For example, for get_admin_roles you could instead do: return self.roles.find(is_admin == True)
16:04.44jkakarbenw1: For get_admin_realms it looks like you want to do a query instead of loading all objects and iterating/filtering them.
16:04.45benw1and that will filter in the db, not Python correct?
16:05.06jkakarbenw1: That's right, it'll generate a query with 'WHERE is_admin = true'.
16:05.15benw1ahh cool
16:10.10benw1and with that, can I filter on the class without an instance?  I get 'no store' error.  I'd like a class method such as 'User.admins' to return a ResultSet of all users who are members of an 'is_admin' role.  I guess I need a store to run a 'find' query with.
16:11.56jkakarbenw1: Yes, in that case you want something like: http://paste.ubuntu.com/171737/
16:12.09jkakarbenw1: Except you probably want to return the result of the store.find.  Ooops. :)
16:14.02benw1so cool
16:14.03jkakarbenw1: Something we do, since we have well defined stores, is provide a method to get the store we want.
16:14.33jkakarbenw1: So, instead of passing a store into a method like that we have the method do: store = get_main_store(), and we defined get_main_store somewhere that knows how to return a usable Store.
16:15.13jkakarbenw1: It makes it so that callers of your code don't need to worry about having a store to pass in.
16:15.38benw1That is definitely what I want
16:16.23jkakarIn our case, we use Zope with the ZStorm integration, so our get_main_store is really just a call to get the IZStorm utility and retrieve a store by name.
16:40.36*** join/#storm shaunm (n=shaunm@proxyserver.wolfram.com)
17:05.19*** join/#storm jukart (n=jukart@d91-128-122-124.cust.tele2.at)
17:15.04*** join/#storm sidnei (n=sidnei@plone/dreamcatcher)
17:41.29*** join/#storm sidnei (n=sidnei@plone/dreamcatcher)
17:51.29*** part/#storm benw1 (n=ben@c-98-232-16-38.hsd1.wa.comcast.net)
18:00.30*** join/#storm sidnei (n=sidnei@plone/dreamcatcher)
21:00.09*** join/#storm thumper (n=tim@canonical/launchpad/thumper)

Generated by irclog2html.pl Modified by Tim Riker to work with infobot.