Univention Bugzilla – Attachment 7741 Details for
Bug 41556
remove dead code from custom-attributes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
More CA removal
41266_remove-ca.diff (text/plain), 15.43 KB, created by
Philipp Hahn
on 2016-06-14 12:13 CEST
(
hide
)
Description:
More CA removal
Filename:
MIME Type:
Creator:
Philipp Hahn
Created:
2016-06-14 12:13 CEST
Size:
15.43 KB
patch
obsolete
>diff --git a/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-manager-modules/modules/univention/admin/objects.py b/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-manager-modules/modules/univention/admin/objects.py >index 05fc089..8b85348 100644 >--- a/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-manager-modules/modules/univention/admin/objects.py >+++ b/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-manager-modules/modules/univention/admin/objects.py >@@ -119,7 +119,7 @@ def description(object): > def shadow(lo, module, object, position): > '''if object is a container, return object and module the container > shadows (that is usually the one that is subordinate in the LDAP tree)''' >- >+ > if not object: > return (None, None) > dn=object.dn >@@ -142,12 +142,6 @@ def dn(object): > else: > return None > >-def arg(object): >- if hasattr(object, 'arg'): >- return object.arg >- else: >- return None >- > def ocToType(oc): > for module in univention.admin.modules.modules.values(): > if univention.admin.modules.policyOc(module) == oc: >@@ -156,13 +150,13 @@ def ocToType(oc): > def fixedAttribute(object, key): > if not hasattr(object, 'fixedAttributes'): > return 0 >- >+ > return object.fixedAttributes().get(key, 0) > > def emptyAttribute(object, key): > if not hasattr(object, 'emptyAttributes'): > return 0 >- >+ > return object.emptyAttributes().get(key, 0) > > def getPolicyReference(object, policy_type): >@@ -200,7 +194,7 @@ def replacePolicyReference(object, policy_type, new_reference): > return > > removePolicyReference(object, policy_type) >- >+ > univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'replacePolicyReference: appending reference: %s' % new_reference) > object.policies.append(new_reference) > >@@ -210,7 +204,7 @@ def restorePolicyReference(object, policy_type): > module=univention.admin.modules.get(policy_type) > if not module: > return >- >+ > removePolicyReference(object, policy_type) > > restore=None >@@ -231,7 +225,7 @@ def wantsCleanup(object): > object_module=univention.admin.modules.get(object_module) > if hasattr(object_module, 'docleanup'): > wantsCleanup=object_module.docleanup >- >+ > return wantsCleanup > > def performCleanup(object): >diff --git a/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-manager-modules/modules/univention/admincli/admin.py b/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-manager-modules/modules/univention/admincli/admin.py >index c304962..85707cb 100755 >--- a/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-manager-modules/modules/univention/admincli/admin.py >+++ b/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-manager-modules/modules/univention/admincli/admin.py >@@ -992,7 +992,6 @@ def _doit(arglist): > try: > for object in univention.admin.modules.lookup(module, co, lo, scope='sub', superordinate=superordinate, base=position.getDn(), filter=filter): > out.append( 'DN: %s' % _2utf8( univention.admin.objects.dn (object ) ) ) >- out.append( 'ARG: %s' % univention.admin.objects.arg( object ) ) > > if (hasattr(module,'virtual') and not module.virtual) or not hasattr(module,'virtual'): > object.open() >diff --git a/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-manager-modules/test/BaseTest.py b/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-manager-modules/test/BaseTest.py >index dc4aa5a..3ee74ba 100644 >--- a/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-manager-modules/test/BaseTest.py >+++ b/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-manager-modules/test/BaseTest.py >@@ -95,7 +95,6 @@ class BaseCase(TestCase): > self.__initOptions(options) > self.ldap = self.__initAccess() > self.__superordinate = None >- self.__arg = None > > def __getDefaultBinddn(self): > return self.rdn('cn=admin') >@@ -220,20 +219,6 @@ class BaseCase(TestCase): > return result[0] > return None, None > >- def arg(self, argument = None): >- '''Set or query the current objects "arg". >- >- Set "arg" to "Argument", if given, otherwise just return it. >- >- Some objects are not stored in their own LDAP object but are >- attached to an existing object. To identify such an object, >- both the DN and the "arg" are needed. >- ''' >- if argument is None: >- return self.__arg >- self.__arg = argument >- return self.__arg >- > def superordinate(self, argument = None): > '''Set or query the current objectts "superordinate". > >@@ -256,7 +241,7 @@ class BaseCase(TestCase): > sup = getattr(argument, 'superordinate') > if callable(sup): > sup = sup() >- kwargs = { 'base': dn, 'scope': 'base', 'superordinate': sup } >+ kwargs = { 'base': dn, 'scope': 'base', 'superordinate': sup } > res = supmod.lookup(self.__config, self.ldap, '', **kwargs) > self.__superordinate = res[0] > return self.__superordinate >@@ -296,11 +281,6 @@ class BaseCase(TestCase): > self.__command.append('--superordinate') > self.__command.append(self.__escape(superordinate)) > >- def arg(self, arg): >- '''Set the "arg" argument.''' >- self.__command.append('--arg') >- self.__command.append(self.__escape(arg)) >- > def dn(self, dn): > '''Set the "dn" argument.''' > self.__command.append('--dn') >@@ -377,7 +357,4 @@ class BaseCase(TestCase): > # set superordinate if present > if self.__superordinate: > cmd.superordinate(self.__superordinate.dn) >- # set arg if present >- if self.__arg: >- cmd.arg(self.__arg) > return cmd >diff --git a/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-manager-modules/test/GenericTest.py b/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-manager-modules/test/GenericTest.py >index 462025c..a22f383 100644 >--- a/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-manager-modules/test/GenericTest.py >+++ b/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-manager-modules/test/GenericTest.py >@@ -31,7 +31,7 @@ > # <http://www.gnu.org/licenses/>. > > >-from BaseTest import BaseCase, TestError, ProcessFailedError >+from BaseTest import BaseCase, TestError > > > class ObjectNotFoundError(TestError): >@@ -47,6 +47,7 @@ class ObjectNotFoundError(TestError): > % (test.name, helper, test.modname) > TestError.__init__(self, error, test) > >+ > class LeftoverObjectFound(TestError): > '''Assertion error in the Univention Admin test suite. > >@@ -60,6 +61,7 @@ class LeftoverObjectFound(TestError): > % (test.name, helper, test.modname) > TestError.__init__(self, error, test) > >+ > class ObjectNotIdentifiedError(TestError): > '''Assertion error in the Univention Admin test suite. > >@@ -70,6 +72,7 @@ class ObjectNotIdentifiedError(TestError): > % (test.name, dn, test.modname) > TestError.__init__(self, error, test) > >+ > class PropertyInvalidError(TestError): > '''Assertion error in the Univention Admin test suite. > >@@ -81,10 +84,11 @@ class PropertyInvalidError(TestError): > e1 = 'Incorrect property %s (%s)' % (property, description) > e2 = 'of object %s at DN %s (module %s).' \ > % (test.name, dn, test.modname) >- e3= 'Expected: "%s" Actual: "%s"' % (expected, actual) >+ e3 = 'Expected: "%s" Actual: "%s"' % (expected, actual) > error = '%s %s %s' % (e1, e2, e3) > TestError.__init__(self, error, test) > >+ > class ObjectClassNotPresentError(TestError): > '''Assertion error in the Univention Admin test suite. > >@@ -97,7 +101,7 @@ class ObjectClassNotPresentError(TestError): > % (option, description) > e2 = 'of object %s at DN %s (module %s).' \ > % (test.name, dn, test.modname) >- e3= 'Expected: "%s" Actual: "%s"' % (expected, actual) >+ e3 = 'Expected: "%s" Actual: "%s"' % (expected, actual) > error = '%s %s %s' % (e1, e2, e3) > TestError.__init__(self, error, test) > >@@ -157,15 +161,17 @@ class GenericTestCase(BaseCase): > # NOTE: this filter might be a little fragile... > cmd.filter('%s="%s"' % (self.identifier, self.name)) > >- def __setupCommandUpdate(self, cmd, name, properties, options = None): >+ def __setupCommandUpdate(self, cmd, name, properties, options=None): > descriptions = self.module.property_descriptions > special = set(('position',)) >- single = (p for p in properties >- if not p in special >- if not descriptions[p].multivalue) >- multi = (p for p in properties >- if not p in special >- if descriptions[p].multivalue) >+ single = ( >+ p for p in properties >+ if p not in special >+ if not descriptions[p].multivalue) >+ multi = ( >+ p for p in properties >+ if p not in special >+ if descriptions[p].multivalue) > # set identifying property > if name is not None: > cmd.set(self.identifier, name) >@@ -276,26 +282,26 @@ class GenericTestCase(BaseCase): > self.dn = dn > self.__leftover_dns.add(dn) > >- def testObjectExists(self, dn = None): >+ def testObjectExists(self, dn=None): > '''Check that the object exists. > > "DN", if given, indicates the DN of the object to test. >- >+ > Raise "ObjectNotFoundError" if it does not exists. > ''' >- dn, attr = self.search(dn = dn) >+ dn, attr = self.search(dn=dn) > if attr is None: > raise ObjectNotFoundError(self, dn) > self.useDN(dn) > >- def testObjectExistsNot(self, dn = None): >+ def testObjectExistsNot(self, dn=None): > '''Check that the object does not exists. > > "DN", if given, indicates the DN of the object to test. > > Raise "LeftoverObjectFound" if it does exists. > ''' >- dn, attr = self.search(dn = dn) >+ dn, attr = self.search(dn=dn) > if bool(attr): > self.useDN(dn) > raise LeftoverObjectFound(self, dn) >@@ -306,7 +312,7 @@ class GenericTestCase(BaseCase): > Raise "ObjectNotIdentifiedError" if the module cannot identify > the current object. > ''' >- _, attr = self.search(dn = self.dn) >+ _, attr = self.search(dn=self.dn) > if not self.module.identify(self.dn, attr): > raise ObjectNotIdentifiedError(self, self.dn) > >@@ -317,7 +323,7 @@ class GenericTestCase(BaseCase): > > Raise "ObjectClassNotPresentError" if an option is not present. > ''' >- attr = self.ldap.get(dn = self.dn, attr = ['objectClass']) >+ attr = self.ldap.get(dn=self.dn, attr=['objectClass']) > for o in options: > classes = self.module.options[o].objectClasses > if not classes: >@@ -336,14 +342,15 @@ class GenericTestCase(BaseCase): > values. > ''' > special = set(('position',)) >- props = (p for p in properties >- if not p in special >- if not p in self.uncheckedProperties) >- obj = self.open(dn = self.dn) >+ props = ( >+ p for p in properties >+ if p not in special >+ if p not in self.uncheckedProperties) >+ obj = self.open(dn=self.dn) > for prop in props: > self._testProperty(prop, obj, properties) > >- def create(self, properties, options = None, name = None): >+ def create(self, properties, options=None, name=None): > '''Create an object of the current module. > > "Properties" is a mapping from property names to values. >@@ -357,9 +364,9 @@ class GenericTestCase(BaseCase): > self.__setupCommandUpdate(cmd, name, properties, options) > return cmd.run() > >- def modify(self, properties, dn = None, name = None, newName = None): >+ def modify(self, properties, dn=None, name=None, newName=None): > '''Modify an object of the current module. >- >+ > "Properties" is a mapping from property names to values; > only values that should be changed need to be included. > "DN", if given, is the DN of the object to modify. >@@ -376,9 +383,9 @@ class GenericTestCase(BaseCase): > self.__setupCommandUpdate(cmd, newName, properties) > return cmd.run() > >- def remove(self, name = None, dn = None, recursive = False): >+ def remove(self, name=None, dn=None, recursive=False): > '''Remove an object of the current module. >- >+ > "Name" is the name of the object to remove (defaults to the current objects name). > "DN", if given, is the DN of the object to remove. > "Recursive" should be True to remove the object recursively. >@@ -391,7 +398,7 @@ class GenericTestCase(BaseCase): > if recursive: > cmd.recursive() > return cmd.run() >- >+ > def hookAfterCreated(self, dn): > '''Perform additional actions after creating an object. > >@@ -418,7 +425,7 @@ class GenericTestCase(BaseCase): > > def setUp(self): > '''Hook method for setting up the test fixture before exercising it. >- >+ > Override this method to set up values for these properties: > "name": The name of the object that will be tested. > You most definitely want to set this one. >@@ -460,7 +467,6 @@ class GenericTestCase(BaseCase): > self.createOptions = set() > self.dn = None > self.superordinate() >- self.arg() > self.__leftover_dns = set() > > def runTest(self): >@@ -484,8 +490,7 @@ class GenericTestCase(BaseCase): > is identified by the module and has the correct options and > property values set. > ''' >- proc = self.create(self.createProperties, >- self.createOptions) >+ proc = self.create(self.createProperties, self.createOptions) > self._checkProcess(proc, 'create') > self.testObjectExists(self.dn) > self.testObjectIdentify() >@@ -500,7 +505,7 @@ class GenericTestCase(BaseCase): > exists, is identified by the module and has the correct property > values set. > ''' >- proc = self.modify(self.modifyProperties, dn = self.dn) >+ proc = self.modify(self.modifyProperties, dn=self.dn) > self._checkProcess(proc, 'modify') > if self.newName is not None: > self.dn = None >@@ -516,7 +521,7 @@ class GenericTestCase(BaseCase): > This test removes the current object and then checks that it > does not exist any more. > ''' >- proc = self.remove(dn = self.dn) >+ proc = self.remove(dn=self.dn) > self._checkProcess(proc, 'remove') > self.testObjectExistsNot(self.dn) > self.hookAfterRemoved(self.dn) >@@ -529,7 +534,7 @@ class GenericTestCase(BaseCase): > When overriding this method, make sure you call to your superclass first! > ''' > for dn in self.__leftover_dns: >- self.remove(dn = dn, recursive = True) >+ self.remove(dn=dn, recursive=True) > > def shortDescription(self): > return 'testing module %s' % self.modname >diff --git a/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-manager-modules/test/TestDnsZoneMxRecord.py b/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-manager-modules/test/TestDnsZoneMxRecord.py >index ed90f53..0652bd9 100644 >--- a/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-manager-modules/test/TestDnsZoneMxRecord.py >+++ b/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-manager-modules/test/TestDnsZoneMxRecord.py >@@ -70,12 +70,6 @@ class DnsZoneMxRecordTestCase(GenericTestCase): > } > self.dn = self.__zone.dn > >- def hookAfterCreated(self, dn): >- self.arg(self.createProperties['mx']) >- >- def hookAfterModified(self, dn): >- self.arg(self.modifyProperties['mx']) >- > # We cannot delete the record at the DN yet, so we can't check for > # object non-existence by DN, so we need to override this method and > # disable the check for object non-existence. >diff --git a/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-manager-modules/test/TestDnsZoneTxtRecord.py b/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-manager-modules/test/TestDnsZoneTxtRecord.py >index 750384b..20c2656 100644 >--- a/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-manager-modules/test/TestDnsZoneTxtRecord.py >+++ b/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-manager-modules/test/TestDnsZoneTxtRecord.py >@@ -70,12 +70,6 @@ class DnsZoneTxtRecordTestCase(GenericTestCase): > } > self.dn = self.__zone.dn > >- def hookAfterCreated(self, dn): >- self.arg(self.createProperties['txt']) >- >- def hookAfterModified(self, dn): >- self.arg(self.modifyProperties['txt']) >- > # We cannot delete the record at the DN yet, so we can't check for > # object non-existence by DN, so we need to override this method and > # disable the check for object non-existence.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 41556
: 7741