accounts2/fas/fas fasLDAP.py,1.8,1.9 t.py,1.1,1.2

Michael Patrick McGrath (mmcgrath) fedora-extras-commits at redhat.com
Thu Apr 26 21:20:55 UTC 2007


Author: mmcgrath

Update of /cvs/fedora/accounts2/fas/fas
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv28392

Modified Files:
	fasLDAP.py t.py 
Log Message:
Major bug fix in fasLDAP


Index: fasLDAP.py
===================================================================
RCS file: /cvs/fedora/accounts2/fas/fas/fasLDAP.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- fasLDAP.py	26 Apr 2007 19:35:50 -0000	1.8
+++ fasLDAP.py	26 Apr 2007 21:20:53 -0000	1.9
@@ -176,6 +176,7 @@
     __base = 'ou=People,dc=fedoraproject,dc=org'
     __server = Server()
     __filter = ''
+    __cn = ''
    
     @classmethod 
     def newPerson(self, cn, givenName, mail, telephoneNumber, postalAddress):
@@ -190,10 +191,6 @@
                                         dt.microsecond)
         attributes = { 'cn' : cn,
                     'objectClass' : ('fedoraPerson', 'inetOrgPerson', 'organizationalPerson', 'person', 'top'),
-#                    'objectClass' : 'inetOrgPerson',
-#                    'objectClass' : 'organizationalPerson',
-#                    'objectClass' : 'person',
-#                    'objectClass' : ('top'),
                     'displayName' : cn,
                     'sn' : cn,
                     'cn' : cn,
@@ -211,9 +208,6 @@
                     'fedoraPersonIrcNick' : '',
                     'userPassword' : 'Disabled'
                     }
-#                    'objectClass' : ('fedoraRole')}
-        print 'cn=%s,%s' % (cn, self.__base)
-        print attributes
         add('cn=%s,%s' % (cn, self.__base), attributes)
         attributes = {
                     'objectClass' : ('organizationalUnit', 'top'),
@@ -225,7 +219,8 @@
     def __getattr__(self, attr):
         if attr.startswith('_'):
 #            print 'GET %s=%s' % (attr, self.__getattr__(attr))
-            pass
+            if attr == '__filter':
+                return self.__filter
         if attr == 'userName':
             return self.__getattr__('cn')
         try:
@@ -238,7 +233,9 @@
 
     def __setattr__(self, attr, value):
         if attr.startswith('_'):
-            return setattr(self.__class__, attr, value)
+            #return setattr(self.__class__, attr, value)
+            self.__dict__[attr] = value
+            return
 
         base = 'cn=%s,ou=People,dc=fedoraproject,dc=org' % self.__getattr__('cn')
         modify(base, attr, value, self.__getattr__(attr))


Index: t.py
===================================================================
RCS file: /cvs/fedora/accounts2/fas/fas/t.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- t.py	26 Mar 2007 15:11:11 -0000	1.1
+++ t.py	26 Apr 2007 21:20:53 -0000	1.2
@@ -1,4 +1,21 @@
-from fasLDAP import Groups
-g = Groups.byGroupName('art')
-print g.__base
-print g.__filter
+class test:
+    __var = 'Uninitalized'
+
+    def __getattr__(self, attr):
+        return self.__getattr__(attr)
+
+    def __setattr__(self, attr, value):
+        self.__dict__[attr] = value
+
+    @classmethod
+    def start(cls):
+        self = cls()
+        return self
+
+p = test.start()
+p.var='first'
+t = test.start()
+t.var='second'
+
+print p.var
+print t.var




More information about the fedora-extras-commits mailing list