[Python Wpg] LdapFS.py moving along, navigation not complete, but semi functional.
Stuart Williams
stuartw at mts.net
Tue Apr 18 12:49:46 EDT 2006
>>>>> Scott Balneaves writes:
> Next on the hitlist: Reading, so I can do things like cat cn. Should be
> cool.
Scott or others,
The following works, but it's returning length = 4096 characters
instead of the length of the attribute. The code in _fusemodule.c
appears to handle setting the length correctly from the string
returned from the read function. Any ideas?
def read(self, path, length, offset):
print "ldapfs:read:read(%s, %d, %d)" % (path, length, offset)
if length == 0:
return ""
pl = path.split('/')
assert pl[0] == '' # should have split on leading /
rdns = pl[1:-1]
rdns.reverse()
attr = pl[-1]
search_dn = ','.join(rdns + [self.basedn])
result = self.conn.search_s(search_dn,
ldap.SCOPE_SUBTREE,
'(objectClass=*)', [attr])
attr_val = result[0][1][attr][0]
print type(attr_val)
print attr_val
print len(attr_val)
return attr_val[offset:offset+length]
More information about the Winnipeg
mailing list