[CalendarServer-changes] [12780] twext/branches/users/cdaboo/jobs

source_changes at macosforge.org source_changes at macosforge.org
Sat Mar 1 07:45:25 PST 2014


Revision: 12780
          http://trac.calendarserver.org//changeset/12780
Author:   cdaboo at apple.com
Date:     2014-03-01 07:45:25 -0800 (Sat, 01 Mar 2014)
Log Message:
-----------
Merge from trunk.

Modified Paths:
--------------
    twext/branches/users/cdaboo/jobs/bin/_build.sh
    twext/branches/users/cdaboo/jobs/twext/enterprise/dal/model.py
    twext/branches/users/cdaboo/jobs/twext/who/directory.py
    twext/branches/users/cdaboo/jobs/twext/who/opendirectory/_constants.py
    twext/branches/users/cdaboo/jobs/twext/who/opendirectory/_service.py
    twext/branches/users/cdaboo/jobs/twext/who/test/test_directory.py
    twext/branches/users/cdaboo/jobs/twext/who/test/test_util.py
    twext/branches/users/cdaboo/jobs/twext/who/util.py

Property Changed:
----------------
    twext/branches/users/cdaboo/jobs/
    twext/branches/users/cdaboo/jobs/twext/


Property changes on: twext/branches/users/cdaboo/jobs
___________________________________________________________________
Added: svn:mergeinfo
   + /twext/trunk:12742-12779

Modified: twext/branches/users/cdaboo/jobs/bin/_build.sh
===================================================================
--- twext/branches/users/cdaboo/jobs/bin/_build.sh	2014-03-01 15:42:17 UTC (rev 12779)
+++ twext/branches/users/cdaboo/jobs/bin/_build.sh	2014-03-01 15:45:25 UTC (rev 12780)
@@ -97,14 +97,18 @@
 
   python="${py_bindir}/python";
 
-  project="$(setup_print name)";
-
   if [ -z "${TWEXT_PKG_CACHE-}" ]; then
     dep_packages="${dev_home}/pkg";
   else
     dep_packages="${TWEXT_PKG_CACHE}";
   fi;
 
+  if [ ! -d "${py_root}" ]; then
+    "${bootstrap_python}" -m virtualenv "${py_root}";
+  fi;
+
+  project="$(setup_print name)";
+
   export PYTHONPATH="${wd}:${PYTHONPATH:-}";
   export _DEVELOP_PROJECT_="${project}";
 


Property changes on: twext/branches/users/cdaboo/jobs/twext
___________________________________________________________________
Modified: svn:mergeinfo
   - /CalDAVTester/trunk/twext:11193-11198
/CalendarServer/branches/config-separation/twext:4379-4443
/CalendarServer/branches/egg-info-351/twext:4589-4625
/CalendarServer/branches/generic-sqlstore/twext:6167-6191
/CalendarServer/branches/new-store/twext:5594-5934
/CalendarServer/branches/new-store-no-caldavfile/twext:5911-5935
/CalendarServer/branches/new-store-no-caldavfile-2/twext:5936-5981
/CalendarServer/branches/release/CalendarServer-4.3-dev/twext:10180-10190,10192
/CalendarServer/branches/release/CalendarServer-5.1-dev/twext:11846
/CalendarServer/branches/users/cdaboo/batchupload-6699/twext:6700-7198
/CalendarServer/branches/users/cdaboo/cached-subscription-calendars-5692/twext:5693-5702
/CalendarServer/branches/users/cdaboo/component-set-fixes/twext:8130-8346
/CalendarServer/branches/users/cdaboo/directory-cache-on-demand-3627/twext:3628-3644
/CalendarServer/branches/users/cdaboo/fix-no-ischedule/twext:11607-11871
/CalendarServer/branches/users/cdaboo/implicituidrace/twext:8137-8141
/CalendarServer/branches/users/cdaboo/ischedule-dkim/twext:9747-9979
/CalendarServer/branches/users/cdaboo/json/twext:11622-11912
/CalendarServer/branches/users/cdaboo/managed-attachments/twext:9985-10145
/CalendarServer/branches/users/cdaboo/more-sharing-5591/twext:5592-5601
/CalendarServer/branches/users/cdaboo/partition-4464/twext:4465-4957
/CalendarServer/branches/users/cdaboo/performance-tweaks/twext:11824-11836
/CalendarServer/branches/users/cdaboo/pods/twext:7297-7377
/CalendarServer/branches/users/cdaboo/pycalendar/twext:7085-7206
/CalendarServer/branches/users/cdaboo/pycard/twext:7227-7237
/CalendarServer/branches/users/cdaboo/queued-attendee-refreshes/twext:7740-8287
/CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twext:5071-5105
/CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twext:11875-11900
/CalendarServer/branches/users/cdaboo/shared-calendars-5187/twext:5188-5440
/CalendarServer/branches/users/cdaboo/sharing-in-the-store/twext:11935-12016
/CalendarServer/branches/users/cdaboo/store-scheduling/twext:10876-11129
/CalendarServer/branches/users/cdaboo/timezones/twext:7443-7699
/CalendarServer/branches/users/cdaboo/txn-debugging/twext:8730-8743
/CalendarServer/branches/users/gaya/sharedgroups-3/twext:11088-11204
/CalendarServer/branches/users/glyph/always-abort-txn-on-error/twext:9958-9969
/CalendarServer/branches/users/glyph/case-insensitive-uid/twext:8772-8805
/CalendarServer/branches/users/glyph/conn-limit/twext:6574-6577
/CalendarServer/branches/users/glyph/contacts-server-merge/twext:4971-5080
/CalendarServer/branches/users/glyph/dalify/twext:6932-7023
/CalendarServer/branches/users/glyph/db-reconnect/twext:6824-6876
/CalendarServer/branches/users/glyph/deploybuild/twext:7563-7572
/CalendarServer/branches/users/glyph/digest-auth-redux/twext:10624-10635
/CalendarServer/branches/users/glyph/disable-quota/twext:7718-7727
/CalendarServer/branches/users/glyph/dont-start-postgres/twext:6592-6614
/CalendarServer/branches/users/glyph/enforce-max-requests/twext:11640-11643
/CalendarServer/branches/users/glyph/hang-fix/twext:11465-11491
/CalendarServer/branches/users/glyph/imip-and-admin-html/twext:7866-7984
/CalendarServer/branches/users/glyph/ipv6-client/twext:9054-9105
/CalendarServer/branches/users/glyph/launchd-wrapper-bis/twext:11413-11436
/CalendarServer/branches/users/glyph/linux-tests/twext:6893-6900
/CalendarServer/branches/users/glyph/log-cleanups/twext:11691-11731
/CalendarServer/branches/users/glyph/migrate-merge/twext:8690-8713
/CalendarServer/branches/users/glyph/misc-portability-fixes/twext:7365-7374
/CalendarServer/branches/users/glyph/more-deferreds-6/twext:6322-6368
/CalendarServer/branches/users/glyph/more-deferreds-7/twext:6369-6445
/CalendarServer/branches/users/glyph/multiget-delete/twext:8321-8330
/CalendarServer/branches/users/glyph/new-export/twext:7444-7485
/CalendarServer/branches/users/glyph/one-home-list-api/twext:10048-10073
/CalendarServer/branches/users/glyph/oracle/twext:7106-7155
/CalendarServer/branches/users/glyph/oracle-nulls/twext:7340-7351
/CalendarServer/branches/users/glyph/other-html/twext:8062-8091
/CalendarServer/branches/users/glyph/parallel-sim/twext:8240-8251
/CalendarServer/branches/users/glyph/parallel-upgrade/twext:8376-8400
/CalendarServer/branches/users/glyph/parallel-upgrade_to_1/twext:8571-8583
/CalendarServer/branches/users/glyph/q/twext:9560-9688
/CalendarServer/branches/users/glyph/queue-locking-and-timing/twext:10204-10289
/CalendarServer/branches/users/glyph/quota/twext:7604-7637
/CalendarServer/branches/users/glyph/sendfdport/twext:5388-5424
/CalendarServer/branches/users/glyph/shared-pool-fixes/twext:8436-8443
/CalendarServer/branches/users/glyph/shared-pool-take2/twext:8155-8174
/CalendarServer/branches/users/glyph/sharedpool/twext:6490-6550
/CalendarServer/branches/users/glyph/sharing-api/twext:9192-9205
/CalendarServer/branches/users/glyph/skip-lonely-vtimezones/twext:8524-8535
/CalendarServer/branches/users/glyph/sql-store/twext:5929-6073
/CalendarServer/branches/users/glyph/start-service-start-loop/twext:11060-11065
/CalendarServer/branches/users/glyph/subtransactions/twext:7248-7258
/CalendarServer/branches/users/glyph/table-alias/twext:8651-8664
/CalendarServer/branches/users/glyph/uidexport/twext:7673-7676
/CalendarServer/branches/users/glyph/unshare-when-access-revoked/twext:10562-10595
/CalendarServer/branches/users/glyph/use-system-twisted/twext:5084-5149
/CalendarServer/branches/users/glyph/uuid-normalize/twext:9268-9296
/CalendarServer/branches/users/glyph/warning-cleanups/twext:11347-11357
/CalendarServer/branches/users/glyph/whenNotProposed/twext:11881-11897
/CalendarServer/branches/users/glyph/xattrs-from-files/twext:7757-7769
/CalendarServer/branches/users/sagen/applepush/twext:8126-8184
/CalendarServer/branches/users/sagen/inboxitems/twext:7380-7381
/CalendarServer/branches/users/sagen/locations-resources/twext:5032-5051
/CalendarServer/branches/users/sagen/locations-resources-2/twext:5052-5061
/CalendarServer/branches/users/sagen/purge_old_events/twext:6735-6746
/CalendarServer/branches/users/sagen/resource-delegates-4038/twext:4040-4067
/CalendarServer/branches/users/sagen/resource-delegates-4066/twext:4068-4075
/CalendarServer/branches/users/sagen/resources-2/twext:5084-5093
/CalendarServer/branches/users/sagen/testing/twext:10827-10851,10853-10855
/CalendarServer/branches/users/wsanchez/transations/twext:5515-5593
   + /CalDAVTester/trunk/twext:11193-11198
/CalendarServer/branches/config-separation/twext:4379-4443
/CalendarServer/branches/egg-info-351/twext:4589-4625
/CalendarServer/branches/generic-sqlstore/twext:6167-6191
/CalendarServer/branches/new-store-no-caldavfile-2/twext:5936-5981
/CalendarServer/branches/new-store-no-caldavfile/twext:5911-5935
/CalendarServer/branches/new-store/twext:5594-5934
/CalendarServer/branches/release/CalendarServer-4.3-dev/twext:10180-10190,10192
/CalendarServer/branches/release/CalendarServer-5.1-dev/twext:11846
/CalendarServer/branches/users/cdaboo/batchupload-6699/twext:6700-7198
/CalendarServer/branches/users/cdaboo/cached-subscription-calendars-5692/twext:5693-5702
/CalendarServer/branches/users/cdaboo/component-set-fixes/twext:8130-8346
/CalendarServer/branches/users/cdaboo/directory-cache-on-demand-3627/twext:3628-3644
/CalendarServer/branches/users/cdaboo/fix-no-ischedule/twext:11607-11871
/CalendarServer/branches/users/cdaboo/implicituidrace/twext:8137-8141
/CalendarServer/branches/users/cdaboo/ischedule-dkim/twext:9747-9979
/CalendarServer/branches/users/cdaboo/json/twext:11622-11912
/CalendarServer/branches/users/cdaboo/managed-attachments/twext:9985-10145
/CalendarServer/branches/users/cdaboo/more-sharing-5591/twext:5592-5601
/CalendarServer/branches/users/cdaboo/partition-4464/twext:4465-4957
/CalendarServer/branches/users/cdaboo/performance-tweaks/twext:11824-11836
/CalendarServer/branches/users/cdaboo/pods/twext:7297-7377
/CalendarServer/branches/users/cdaboo/pycalendar/twext:7085-7206
/CalendarServer/branches/users/cdaboo/pycard/twext:7227-7237
/CalendarServer/branches/users/cdaboo/queued-attendee-refreshes/twext:7740-8287
/CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twext:5071-5105
/CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twext:11875-11900
/CalendarServer/branches/users/cdaboo/shared-calendars-5187/twext:5188-5440
/CalendarServer/branches/users/cdaboo/sharing-in-the-store/twext:11935-12016
/CalendarServer/branches/users/cdaboo/store-scheduling/twext:10876-11129
/CalendarServer/branches/users/cdaboo/timezones/twext:7443-7699
/CalendarServer/branches/users/cdaboo/txn-debugging/twext:8730-8743
/CalendarServer/branches/users/gaya/sharedgroups-3/twext:11088-11204
/CalendarServer/branches/users/glyph/always-abort-txn-on-error/twext:9958-9969
/CalendarServer/branches/users/glyph/case-insensitive-uid/twext:8772-8805
/CalendarServer/branches/users/glyph/conn-limit/twext:6574-6577
/CalendarServer/branches/users/glyph/contacts-server-merge/twext:4971-5080
/CalendarServer/branches/users/glyph/dalify/twext:6932-7023
/CalendarServer/branches/users/glyph/db-reconnect/twext:6824-6876
/CalendarServer/branches/users/glyph/deploybuild/twext:7563-7572
/CalendarServer/branches/users/glyph/digest-auth-redux/twext:10624-10635
/CalendarServer/branches/users/glyph/disable-quota/twext:7718-7727
/CalendarServer/branches/users/glyph/dont-start-postgres/twext:6592-6614
/CalendarServer/branches/users/glyph/enforce-max-requests/twext:11640-11643
/CalendarServer/branches/users/glyph/hang-fix/twext:11465-11491
/CalendarServer/branches/users/glyph/imip-and-admin-html/twext:7866-7984
/CalendarServer/branches/users/glyph/ipv6-client/twext:9054-9105
/CalendarServer/branches/users/glyph/launchd-wrapper-bis/twext:11413-11436
/CalendarServer/branches/users/glyph/linux-tests/twext:6893-6900
/CalendarServer/branches/users/glyph/log-cleanups/twext:11691-11731
/CalendarServer/branches/users/glyph/migrate-merge/twext:8690-8713
/CalendarServer/branches/users/glyph/misc-portability-fixes/twext:7365-7374
/CalendarServer/branches/users/glyph/more-deferreds-6/twext:6322-6368
/CalendarServer/branches/users/glyph/more-deferreds-7/twext:6369-6445
/CalendarServer/branches/users/glyph/multiget-delete/twext:8321-8330
/CalendarServer/branches/users/glyph/new-export/twext:7444-7485
/CalendarServer/branches/users/glyph/one-home-list-api/twext:10048-10073
/CalendarServer/branches/users/glyph/oracle-nulls/twext:7340-7351
/CalendarServer/branches/users/glyph/oracle/twext:7106-7155
/CalendarServer/branches/users/glyph/other-html/twext:8062-8091
/CalendarServer/branches/users/glyph/parallel-sim/twext:8240-8251
/CalendarServer/branches/users/glyph/parallel-upgrade/twext:8376-8400
/CalendarServer/branches/users/glyph/parallel-upgrade_to_1/twext:8571-8583
/CalendarServer/branches/users/glyph/q/twext:9560-9688
/CalendarServer/branches/users/glyph/queue-locking-and-timing/twext:10204-10289
/CalendarServer/branches/users/glyph/quota/twext:7604-7637
/CalendarServer/branches/users/glyph/sendfdport/twext:5388-5424
/CalendarServer/branches/users/glyph/shared-pool-fixes/twext:8436-8443
/CalendarServer/branches/users/glyph/shared-pool-take2/twext:8155-8174
/CalendarServer/branches/users/glyph/sharedpool/twext:6490-6550
/CalendarServer/branches/users/glyph/sharing-api/twext:9192-9205
/CalendarServer/branches/users/glyph/skip-lonely-vtimezones/twext:8524-8535
/CalendarServer/branches/users/glyph/sql-store/twext:5929-6073
/CalendarServer/branches/users/glyph/start-service-start-loop/twext:11060-11065
/CalendarServer/branches/users/glyph/subtransactions/twext:7248-7258
/CalendarServer/branches/users/glyph/table-alias/twext:8651-8664
/CalendarServer/branches/users/glyph/uidexport/twext:7673-7676
/CalendarServer/branches/users/glyph/unshare-when-access-revoked/twext:10562-10595
/CalendarServer/branches/users/glyph/use-system-twisted/twext:5084-5149
/CalendarServer/branches/users/glyph/uuid-normalize/twext:9268-9296
/CalendarServer/branches/users/glyph/warning-cleanups/twext:11347-11357
/CalendarServer/branches/users/glyph/whenNotProposed/twext:11881-11897
/CalendarServer/branches/users/glyph/xattrs-from-files/twext:7757-7769
/CalendarServer/branches/users/sagen/applepush/twext:8126-8184
/CalendarServer/branches/users/sagen/inboxitems/twext:7380-7381
/CalendarServer/branches/users/sagen/locations-resources-2/twext:5052-5061
/CalendarServer/branches/users/sagen/locations-resources/twext:5032-5051
/CalendarServer/branches/users/sagen/purge_old_events/twext:6735-6746
/CalendarServer/branches/users/sagen/resource-delegates-4038/twext:4040-4067
/CalendarServer/branches/users/sagen/resource-delegates-4066/twext:4068-4075
/CalendarServer/branches/users/sagen/resources-2/twext:5084-5093
/CalendarServer/branches/users/sagen/testing/twext:10827-10851,10853-10855
/CalendarServer/branches/users/wsanchez/transations/twext:5515-5593
/twext/trunk/twext:12742-12779

Modified: twext/branches/users/cdaboo/jobs/twext/enterprise/dal/model.py
===================================================================
--- twext/branches/users/cdaboo/jobs/twext/enterprise/dal/model.py	2014-03-01 15:42:17 UTC (rev 12779)
+++ twext/branches/users/cdaboo/jobs/twext/enterprise/dal/model.py	2014-03-01 15:45:25 UTC (rev 12780)
@@ -321,10 +321,14 @@
         otherColumns = dict([
             (item.name.lower(), item) for item in other.columns
         ])
-        for item in set(myColumns.keys()) ^ set(otherColumns.keys()):
+        for item in set(myColumns.keys()) - set(otherColumns.keys()):
             results.append(
-                "Table: %s, missing column: %s" % (self.name, item,)
+                "Table: %s, extra column: %s" % (self.name, myColumns[item].name,)
             )
+        for item in set(otherColumns.keys()) - set(myColumns.keys()):
+            results.append(
+                "Table: %s, missing column: %s" % (self.name, otherColumns[item].name,)
+            )
 
         for name in set(myColumns.keys()) & set(otherColumns.keys()):
             results.extend(myColumns[name].compare(otherColumns[name]))
@@ -593,13 +597,13 @@
             ])
             for item in set(myItems.keys()) - set(otherItems.keys()):
                 results.append(
-                    "Schema: %s, missing %s: %s"
-                    % (other.filename, descriptor, item)
+                    "Schema: %s, extra %s: %s"
+                    % (other.filename, descriptor, myItems[item].name)
                 )
             for item in set(otherItems.keys()) - set(myItems.keys()):
                 results.append(
                     "Schema: %s, missing %s: %s"
-                    % (self.filename, descriptor, item)
+                    % (self.filename, descriptor, otherItems[item].name)
                 )
 
             for name in set(myItems.keys()) & set(otherItems.keys()):

Modified: twext/branches/users/cdaboo/jobs/twext/who/directory.py
===================================================================
--- twext/branches/users/cdaboo/jobs/twext/who/directory.py	2014-03-01 15:42:17 UTC (rev 12779)
+++ twext/branches/users/cdaboo/jobs/twext/who/directory.py	2014-03-01 15:45:25 UTC (rev 12780)
@@ -365,7 +365,7 @@
             elif issubclass(expectedType, Names):
                 expectedType = NamedConstant
 
-            if not isinstance(value, expectedType):
+            if value is not None and not isinstance(value, expectedType):
                 raise InvalidDirectoryRecordError(
                     "Value {0!r} for field {1} is not of type {2}".format(
                         value, name, expectedType

Modified: twext/branches/users/cdaboo/jobs/twext/who/opendirectory/_constants.py
===================================================================
--- twext/branches/users/cdaboo/jobs/twext/who/opendirectory/_constants.py	2014-03-01 15:42:17 UTC (rev 12779)
+++ twext/branches/users/cdaboo/jobs/twext/who/opendirectory/_constants.py	2014-03-01 15:45:25 UTC (rev 12780)
@@ -45,8 +45,15 @@
     metaRecordName.description = u"meta record name"
     metaRecordName.multiValue = False
 
+    memberUIDs = NamedConstant()
+    memberUIDs.description = u"member UIDs (excluding groups)"
+    memberUIDs.multiValue = True
 
+    nestedGroupsUIDs = NamedConstant()
+    nestedGroupsUIDs.description = u"nested group member UIDs"
+    nestedGroupsUIDs.multiValue = True
 
+
 #
 # OD constants
 #
@@ -159,6 +166,12 @@
     metaRecordName = ValueConstant(u"dsAttrTypeStandard:AppleMetaRecordName")
     metaRecordName.fieldName = FieldName.metaRecordName
 
+    groupMembers = ValueConstant(u"dsAttrTypeStandard:GroupMembers")
+    groupMembers.fieldName = FieldName.memberUIDs
+
+    nestedGroups = ValueConstant(u"dsAttrTypeStandard:NestedGroups")
+    nestedGroups.fieldName = FieldName.nestedGroupsUIDs
+
     # # Single value fields
     # AdminLimits = ValueConstant(u"dsAttrTypeStandard:AdminLimits")
     # AppleAliasData = ValueConstant(u"dsAttrTypeStandard:AppleAliasData")

Modified: twext/branches/users/cdaboo/jobs/twext/who/opendirectory/_service.py
===================================================================
--- twext/branches/users/cdaboo/jobs/twext/who/opendirectory/_service.py	2014-03-01 15:42:17 UTC (rev 12779)
+++ twext/branches/users/cdaboo/jobs/twext/who/opendirectory/_service.py	2014-03-01 15:45:25 UTC (rev 12780)
@@ -634,7 +634,7 @@
                 "GUID field is required.", fields
             )
 
-        fields[service.fieldName.uid] = unicode(guid)
+        fields[service.fieldName.uid] = unicode(guid).upper()
 
         super(DirectoryRecord, self).__init__(service, fields)
         self._odRecord = odRecord
@@ -720,6 +720,17 @@
 
 
 
+    @inlineCallbacks
+    def members(self):
+        members = set()
+        for uid in getattr(self, "memberUIDs", ()):
+            members.add((yield self.service.recordWithUID(uid)))
+        for uid in getattr(self, "nestedGroupsUIDs", ()):
+            members.add((yield self.service.recordWithUID(uid)))
+        returnValue(members)
+
+
+
 class NoQOPDigestCredentialFactory(DigestCredentialFactory):
     """
     DigestCredentialFactory without qop, to interop with OD.

Modified: twext/branches/users/cdaboo/jobs/twext/who/test/test_directory.py
===================================================================
--- twext/branches/users/cdaboo/jobs/twext/who/test/test_directory.py	2014-03-01 15:42:17 UTC (rev 12779)
+++ twext/branches/users/cdaboo/jobs/twext/who/test/test_directory.py	2014-03-01 15:45:25 UTC (rev 12780)
@@ -588,6 +588,13 @@
         FieldName.shortNames: (u"nobody",),
     }
 
+    fields_none_password = {
+        FieldName.uid: u"UID:nobody",
+        FieldName.recordType: RecordType.user,
+        FieldName.shortNames: (u"nobody",),
+        FieldName.password: None,
+    }
+
     fields_staff = {
         FieldName.uid: u"UID:staff",
         FieldName.recordType: RecordType.group,
@@ -732,6 +739,16 @@
         )
 
 
+    def test_noneIsAllowed(self):
+        """
+        Verify a value of None is allowed
+        """
+        service  = self.service()
+        record = self.makeRecord(self.fields_none_password, service=service)
+
+        self.assertEquals(record.password, None)
+
+
     def _test_containerClassFieldType(self, callback):
         """
         Scaffold for test_initWithContainerClassFieldType_*.

Modified: twext/branches/users/cdaboo/jobs/twext/who/test/test_util.py
===================================================================
--- twext/branches/users/cdaboo/jobs/twext/who/test/test_util.py	2014-03-01 15:42:17 UTC (rev 12779)
+++ twext/branches/users/cdaboo/jobs/twext/who/test/test_util.py	2014-03-01 15:45:25 UTC (rev 12780)
@@ -155,13 +155,20 @@
         self.assertRaises(TypeError, ConstantsContainer, (Tools, Switches))
 
 
-    def test_conflictingNames(self):
+    def test_conflictingNames_different(self):
         """
-        A container can't contain two constants with the same name.
+        A container can't contain two different constants with the same name.
         """
         self.assertRaises(ValueError, ConstantsContainer, (Tools, Instruments))
 
 
+    def test_conflictingNames_same(self):
+        """
+        A container can combine containers which contain the same constants.
+        """
+        ConstantsContainer((Tools, Tools))
+
+
     def test_notConstantClass(self):
         """
         A container can't contain random classes.

Modified: twext/branches/users/cdaboo/jobs/twext/who/util.py
===================================================================
--- twext/branches/users/cdaboo/jobs/twext/who/util.py	2014-03-01 15:42:17 UTC (rev 12779)
+++ twext/branches/users/cdaboo/jobs/twext/who/util.py	2014-03-01 15:45:25 UTC (rev 12780)
@@ -79,21 +79,27 @@
                 if issubclass(self._constantsClass, ValueConstant):
                     self.lookupByValue = self._lookupByValue
 
-            if constant.name in self._constants:
+            if (
+                constant.name in self._constants and
+                self._constants[constant.name] is not constant
+            ):
                 raise ValueError("Name conflict: {0}".format(constant.name))
 
             self._constants[constant.name] = constant
 
 
     def _addMethods(self, methods):
-        for name, value in methods:
+        for name, method in methods:
             if name[0] == "_":
                 continue
 
-            if name in self._constants or name in self._methods:
+            if (
+                name in self._constants or
+                (name in self._methods and self._methods[name] is not method)
+            ):
                 raise ValueError("Name conflict: {0}".format(name))
 
-            self._methods[name] = value
+            self._methods[name] = method
 
 
     def __getattr__(self, name):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140301/4d8c41de/attachment-0001.html>


More information about the calendarserver-changes mailing list