[Testbot] Plone 4.3 - Python 2.6 - Build # 2434 - Still failing! - 2 failure(s)
jenkins at plone.org
jenkins at plone.org
Thu Oct 16 14:25:13 UTC 2014
-------------------------------------------------------------------------------
Plone 4.3 - Python 2.6 - Build # 2434 - Still Failing!
-------------------------------------------------------------------------------
http://jenkins.plone.org/job/plone-4.3-python-2.6/2434/
-------------------------------------------------------------------------------
CHANGES
-------------------------------------------------------------------------------
Repository: plone.dexterity
Branch: refs/heads/master
Date: 2014-10-16T15:39:59+02:00
Author: Jens W. Klein (jensens) <jk at kleinundpartner.at>
Commit: https://github.com/plone/plone.dexterity/commit/10bcb90aa8d9513b51b90a38de8bf7436c05d665
same logic but follow DRI
Files changed:
M plone/dexterity/content.py
diff --git a/plone/dexterity/content.py b/plone/dexterity/content.py
index 2dcede4..ea43faa 100644
--- a/plone/dexterity/content.py
+++ b/plone/dexterity/content.py
@@ -50,6 +50,24 @@
CEILING_DATE = DateTime(2500, 0) # never expires
+def _default_from_schema(context, schema, fieldname):
+ """helper to lookup default value of a field
+ """
+ if schema is None:
+ return _marker
+ field = schema.get(fieldname, None)
+ if field is None:
+ return _marker
+ if IContextAwareDefaultFactory.providedBy(
+ getattr(field, 'defaultFactory', None)
+ ):
+ bound = field.bind(context)
+ return deepcopy(bound.default)
+ else:
+ return deepcopy(field.default)
+ return _marker
+
+
class FTIAwareSpecification(ObjectSpecificationDescriptor):
"""A __providedBy__ decorator that returns the interfaces provided by
the object, plus the schema interface set in the FTI.
@@ -281,27 +299,19 @@ def __getattr__(self, name):
# attribute was not found; try to look it up in the schema and return
# a default
- schema = SCHEMA_CACHE.get(self.portal_type)
- if schema is not None:
- field = schema.get(name, None)
- if field is not None:
- if IContextAwareDefaultFactory.providedBy(
- getattr(field, 'defaultFactory', None)):
- bound = field.bind(self)
- return deepcopy(bound.default)
- else:
- return deepcopy(field.default)
+ value = _default_from_schema(
+ self,
+ SCHEMA_CACHE.get(self.portal_type),
+ name
+ )
+ if value is not _marker:
+ return value
# do the same for each subtype
for schema in SCHEMA_CACHE.subtypes(self.portal_type):
- field = schema.get(name, None)
- if field is not None:
- if IContextAwareDefaultFactory.providedBy(
- getattr(field, 'defaultFactory', None)):
- bound = field.bind(self)
- return deepcopy(bound.default)
- else:
- return deepcopy(field.default)
+ value = _default_from_schema(self, schema, name)
+ if value is not _marker:
+ return value
raise AttributeError(name)
-------------------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CHANGES.log
Type: application/octet-stream
Size: 2724 bytes
Desc: not available
URL: <http://lists.plone.org/pipermail/plone-testbot/attachments/20141016/e878b95c/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: build.log
Type: application/octet-stream
Size: 172797 bytes
Desc: not available
URL: <http://lists.plone.org/pipermail/plone-testbot/attachments/20141016/e878b95c/attachment-0003.obj>
More information about the Testbot
mailing list