2009-07-29T00:34:02  <thw> gn
2009-07-29T00:39:10  *** thw has quit IRC
2009-07-29T01:22:03  *** grzywacz has quit IRC
2009-07-29T05:47:10  *** amartani has quit IRC
2009-07-29T11:51:04  *** grzywacz has joined #moin-dev
2009-07-29T14:35:03  <ThomasWaldmann> re
2009-07-29T14:55:37  <_peck_> i've got my patch
2009-07-29T15:02:15  <_peck_> made with hg patch -U3, should i put it in a separate page and reference it in http://moinmo.in/Groups2009 ?
2009-07-29T15:39:49  <ThomasWaldmann> you could just attach it and reference it from there
2009-07-29T15:40:28  <ThomasWaldmann> except if you would write lots of text about it, then a separate page like LdapGroups is maybe better (and link it from Groups2009)
2009-07-29T15:45:57  <_peck_> done : http://moinmo.in/Groups2009?action=AttachFile&do=view&target=ldap_groups.patch
2009-07-29T15:46:10  <_peck_> i didn't write much doc
2009-07-29T15:46:25  <_peck_> i should add how to create a config
2009-07-29T15:49:23  * ThomasWaldmann looks
2009-07-29T15:49:49  <ThomasWaldmann> btw, if you do a local commit to your repo, you can just use hg export to export "patch like" changesets
2009-07-29T15:50:47  <dimazest> nice :)
2009-07-29T15:51:08  <ThomasWaldmann> _peck_: check line 20/21 for typos/grammar
2009-07-29T15:51:56  <_peck_> s/can//
2009-07-29T15:52:03  <ThomasWaldmann> _peck_: maybe reorder imports like this: 1. stdlib stuff, 2. other external stuff, 3. MoinMoin stuff
2009-07-29T15:52:49  <_peck_> ldap must be exported afterwards in ldap_groups because it is ldap_connection that triggers the exception
2009-07-29T15:53:58  <ThomasWaldmann> line 54: no parens
2009-07-29T15:54:37  <dimazest> ThomasWaldmann: how should i write code http://paste.pocoo.org/show/62bEXgcOKhQXK0Ta1WJj/
2009-07-29T15:54:39  <ThomasWaldmann> if filter and filter[0] != '(':
2009-07-29T15:54:56  *** devilsadvocate has quit IRC
2009-07-29T15:54:59  <ThomasWaldmann> or even: if not filter.startswith('('):
2009-07-29T15:55:10  <dimazest> for me the first case is harder to read
2009-07-29T15:56:59  <ThomasWaldmann> line 55: filter = '(%s)' % filter
2009-07-29T15:58:20  <ThomasWaldmann> line 66: hmm, __iter__ should iterate over group names, but you just return DNs there, right?
2009-07-29T15:59:52  <_peck_> exact
2009-07-29T16:00:11  <_peck_> i should map a dn extraction
2009-07-29T16:02:11  <ThomasWaldmann> line 80: maybe use try: ... except AttributeError: ...
2009-07-29T16:02:30  <ThomasWaldmann> (or at least add the blank or our pep8 checker will complain about it)
2009-07-29T16:03:28  <ThomasWaldmann> line 91: if not grp: ...
2009-07-29T16:04:34  <ThomasWaldmann> line 95: filter = '(%s=%s)' % (self.name_attribute, group)
2009-07-29T16:04:52  <ThomasWaldmann> 96: if self.filter:
2009-07-29T16:05:08  <ThomasWaldmann> 97: ...
2009-07-29T16:05:57  <ThomasWaldmann> 99: if member: filter = ...
2009-07-29T16:06:03  <ThomasWaldmann> 100: return filter
2009-07-29T16:07:13  <ThomasWaldmann> _peck_: tell me if you catched up :)
2009-07-29T16:11:12  * ThomasWaldmann now reads LDAPConnection
2009-07-29T16:11:33  <ThomasWaldmann> 111: typo, see 109
2009-07-29T16:11:36  <_peck_> line 80: i don't understand the problem
2009-07-29T16:11:55  <ThomasWaldmann> line 80 works like you did it
2009-07-29T16:12:12  <ThomasWaldmann> but our pep8 checker will miss that blank after the comma and complain about it
2009-07-29T16:12:25  <ThomasWaldmann> (it is rather picky :)
2009-07-29T16:13:14  <ThomasWaldmann> about the try/except method I suggested: the point is to not check, but just try what usually should work and catch the exception if it does not work.
2009-07-29T16:13:20  <_peck_> so why not just add a blank ?
2009-07-29T16:13:28  <_peck_> ah ok
2009-07-29T16:15:55  <ThomasWaldmann> (in that case, it is a really minor thing, but for some other applications, this can also improve speed, e.g. instead of doing "if backend.has_item(x): return backend.get_item(x)" you can just do "try: return backend.get_item(x) except NoSuchItemError: ..." and you usually save the has_item check.
2009-07-29T16:21:28  <ThomasWaldmann> _peck_: btw, you usually want to use new style classes, thus class Foo(object):
2009-07-29T16:21:45  <ThomasWaldmann> (see LDAPConnection for example)
2009-07-29T16:23:31  <_peck_> which style ?
2009-07-29T16:23:47  <ThomasWaldmann> "new style" classes derive from object class
2009-07-29T16:23:53  <_peck_> you mean using object as a default ancestor ?
2009-07-29T16:23:58  <ThomasWaldmann> yes
2009-07-29T16:24:10  <_peck_> ok
2009-07-29T16:24:24  <ThomasWaldmann> "old style" classes are rather deprecated and have some limitations
2009-07-29T16:24:45  <_peck_> like what ?
2009-07-29T16:24:55  <_peck_> i'm not a python master
2009-07-29T16:25:06  <ThomasWaldmann> btw, as you likely copied some of the code from ldap_login, please also copy the (c) holders
2009-07-29T16:25:07  <dennda> class Foo: -> class Foo(object):
2009-07-29T16:25:52  <ThomasWaldmann> _peck_: if you work with us for a while, you'll be :D
2009-07-29T16:26:21  <_peck_> :)
2009-07-29T16:28:00  <dimazest> :)
2009-07-29T16:29:12  <_peck_> ok i've taken your remarks into account, one more test and i will export again
2009-07-29T16:29:37  <ThomasWaldmann> btw, just grep for == None and != None.
2009-07-29T16:30:21  <ThomasWaldmann> you either want to just replace that by "if x:" or, if you check needs to be very specific, by "if x is (not) None"
2009-07-29T16:31:43  *** amartani has joined #moin-dev
2009-07-29T16:32:10  <_peck_> ok
2009-07-29T16:33:21  <_peck_> anything else ?
2009-07-29T16:33:22  <ThomasWaldmann> btw, I am thinking about LDAPConnection
2009-07-29T16:33:41  <ThomasWaldmann> isn't self.ldap there the "real" connection object?
2009-07-29T16:35:00  <_peck_> yes
2009-07-29T16:35:32  <ThomasWaldmann> so maybe we could just have a "ldap_connect(...)" function, that returns this as result?
2009-07-29T16:36:30  <ThomasWaldmann> (and does set all those ldap options, protocol_version, start tls if needed)
2009-07-29T16:36:35  <_peck_> the objectclass gives me a wrapper si that i can use simple methods in ldap_group
2009-07-29T16:37:28  <ThomasWaldmann> yes, but you wanted just a connection object, not a complete wrapper around ldap api?
2009-07-29T16:37:56  <ThomasWaldmann> (problem with such wrappers can be that they are not flexible enough, miss methods, ...)
2009-07-29T16:38:02  <_peck_> if you want the object, the ldap attribute is still there and can be used
2009-07-29T16:38:39  <_peck_> the goal of the wrapper is just to provide a utility method
2009-07-29T16:38:53  <ThomasWaldmann> btw, do not use print, rather use logging.debug(...)
2009-07-29T16:38:58  <_peck_> the best way may be to inherit from ldap
2009-07-29T16:42:47  <ThomasWaldmann> not sure about that, see above :)
2009-07-29T16:43:49  <ThomasWaldmann> btw, just doing the connect would also require less code changes in ldap_login
2009-07-29T16:44:21  <ThomasWaldmann> and people who used python-ldap api do not need to learn the wrapper then
2009-07-29T16:45:59  <ThomasWaldmann> btw, if you are refactoring that stuff anyway: maybe get rid of that "l" variable, maybe rename it to "conn" or so.
2009-07-29T16:47:38  <ThomasWaldmann> 234..238 maybe rather use list comprehensions than map/lambda
2009-07-29T17:13:55  *** amartani has quit IRC
2009-07-29T17:16:28  *** amartani has joined #moin-dev
2009-07-29T18:32:42  <_peck_> is there a special page where groups.__iter__ is called ?
2009-07-29T18:44:17  <ThomasWaldmann> iirc it is only used to determine in which groups someone is a member
2009-07-29T18:48:49  <dimazest> _peck_: http://localhost:8080/SystemAdmin?sysadm=users
2009-07-29T18:49:05  <dimazest> dreimark: ThomasWaldmann http://moinmo.in/Xapian2009/2009-07-29
2009-07-29T18:50:06  <dimazest> code is too messy and unstabe to commit. it is still half experimental
2009-07-29T18:57:09  <_peck_> dimazest: i can't see such a page, do i need to be a special user ?
2009-07-29T19:04:19  <ThomasWaldmann> dimazest: be careful with qp. moin needs the queries that a user puts into the search box to be uniform, no matter whether xapian or slow builtin search is used.
2009-07-29T19:05:27  * ThomasWaldmann had the vague idea of a slow pure-python xapian compatible thing, that would also solve that problem. but likely that is way beyond what we can do now.
2009-07-29T19:06:59  <ThomasWaldmann> also, be careful with ACLs. The indexer will run with high priviledges, so it can read and index anything. But that doesn't mean that everybody and his dog should find any acl protected content that he usually could not see.
2009-07-29T19:08:07  <ThomasWaldmann> (iirc that was the main reason why the current code uses xapian just to do some sort of "pre-filtering" and then calls the slow search with the filtered page list)
2009-07-29T19:15:57  <_peck_> how can i reverse the page_group_regex ? should i just append Group or is there another way ?
2009-07-29T19:19:51  <dimazest> ThomasWaldmann: sintax of queries is similar for moin and xappy, but i need to check it to be sure. search results may be indexed after search, i think it is better than getting 10000 search results and use 10
2009-07-29T19:21:05  <dimazest> ThomasWaldmann: and now my idea to make searcher just searchers, and then something other, which take care of acls, formatting, ...
2009-07-29T19:21:33  <ThomasWaldmann> _peck_: i don't think there is a way yet. do you need that?
2009-07-29T19:21:53  *** cdyson37 has joined #moin-dev
2009-07-29T19:22:20  <_peck_> for the iter method which needs wiki group names from ldap group names
2009-07-29T19:23:44  <dimazest> _peck_: if you run wiki with ./wikiserver.py you need to be logged in
2009-07-29T19:24:00  <ThomasWaldmann> _peck_: ah, yes. that should yield FooGroup, not Foo.
2009-07-29T19:24:16  <_peck_> dimazest: yes i finally found how to see the page
2009-07-29T19:24:35  <ThomasWaldmann> _peck_: for now, just append "Group" and put a # XXX needs configurability there
2009-07-29T19:24:46  <_peck_> ok
2009-07-29T19:32:05  <ThomasWaldmann> gtg/brb
2009-07-29T20:31:35  <_peck_> I updated the patch on the wiki
2009-07-29T20:57:25  <ThomasWaldmann> re
2009-07-29T20:59:53  <ThomasWaldmann> _peck_: line 55 first term is superfluous
2009-07-29T21:01:19  <ThomasWaldmann> 72: iter(res)
2009-07-29T21:02:04  <ThomasWaldmann> in general: no blank after f(
2009-07-29T21:02:09  <ThomasWaldmann> (see PEP8)
2009-07-29T21:06:27  <ThomasWaldmann> btw, if you have py.test (google for py lib codespeak) installed, you can just invoke py.test
2009-07-29T21:06:35  <ThomasWaldmann> from the toplevel code dir
2009-07-29T21:06:52  <ThomasWaldmann> if test_sourcecode fails, it points your to such stuff
2009-07-29T21:12:20  <ThomasWaldmann> 240: no ( after if
2009-07-29T21:19:33  <ThomasWaldmann> _peck_: 139/140 you would not have that problem if you would not wrap that much, but just return the conn
2009-07-29T22:15:16  *** starshine_away is now known as starshine
2009-07-29T22:30:38  *** starshine is now known as starshine_away

MoinMoin: MoinMoinChat/Logs/moin-dev/2009-07-29 (last edited 2009-07-28 22:45:02 by IrcLogImporter)