# HG changeset patch # User Denis Laxalde # Date 1506415603 -7200 # Node ID 1c912b7d95035ae08841c908cc1ae261c46d5776 # Parent 2b78124386b278656714b1dfaf62233cd0aa629a [entities] Restore dc_ methods instead of __getattr__ proxy In 8de62610cea2, a __getattr__ proxy was introduced to handle compatibility with dc_* methods being called on entity instances instead of through the IDublinCore adapter. Unfortunately, __getattr__ does not play well with super() and since the latter is often used by, we here restore all dc_ methods with an explicit proxy to the adapter. More verbose but should work. Closes #17103999. diff -r 2b78124386b2 -r 1c912b7d9503 cubicweb/entities/__init__.py --- a/cubicweb/entities/__init__.py Wed Sep 13 17:19:42 2017 +0200 +++ b/cubicweb/entities/__init__.py Tue Sep 26 10:46:43 2017 +0200 @@ -98,15 +98,29 @@ # meta data api ########################################################### - def __getattr__(self, name): - prefix = 'dc_' - if name.startswith(prefix): - # Proxy to IDublinCore adapter for bw compat. - adapted = self.cw_adapt_to('IDublinCore') - method = name[len(prefix):] - if hasattr(adapted, method): - return getattr(adapted, method) - raise AttributeError(name) + def dc_title(self): + return self.cw_adapt_to('IDublinCore').title() + + def dc_long_title(self): + return self.cw_adapt_to('IDublinCore').long_title() + + def dc_description(self, *args, **kwargs): + return self.cw_adapt_to('IDublinCore').description(*args, **kwargs) + + def dc_authors(self): + return self.cw_adapt_to('IDublinCore').authors() + + def dc_creator(self): + return self.cw_adapt_to('IDublinCore').creator() + + def dc_date(self, *args, **kwargs): + return self.cw_adapt_to('IDublinCore').date(*args, **kwargs) + + def dc_type(self, *args, **kwargs): + return self.cw_adapt_to('IDublinCore').type(*args, **kwargs) + + def dc_language(self): + return self.cw_adapt_to('IDublinCore').language() @property def creator(self):