[Erp5-report] r13435 - in /erp5/trunk/products/ERP5Type/Accessor: Related.py RelatedValue.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Mar 15 17:26:19 CET 2007


Author: romain
Date: Thu Mar 15 17:26:17 2007
New Revision: 13435

URL: http://svn.erp5.org?rev=13435&view=rev
Log:
Add restricted Related/RelatedValue accessor classes.

Modified:
    erp5/trunk/products/ERP5Type/Accessor/Related.py
    erp5/trunk/products/ERP5Type/Accessor/RelatedValue.py

Modified: erp5/trunk/products/ERP5Type/Accessor/Related.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Accessor/Related.py?rev=13435&r1=13434&r2=13435&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Accessor/Related.py (original)
+++ erp5/trunk/products/ERP5Type/Accessor/Related.py Thu Mar 15 17:26:17 2007
@@ -61,6 +61,24 @@
 
 Getter = DefaultGetter
 
+class RestrictedDefaultGetter(DefaultGetter):
+  """
+  Gets a default reference object
+  """
+  def __call__(self, instance, *args, **kw):
+    if self._warning:
+      LOG("ERP5Type Deprecated Getter Id:",0, self._id)
+    return instance._getDefaultRelatedProperty(
+                     self._key, 'relative_url',
+                     spec=kw.get('spec',()),
+                     filter=kw.get('filter', None),
+                     portal_type=kw.get('portal_type',()),
+                     query=instance.portal_catalog.getSecurityQuery(),)
+
+  psyco.bind(__call__)
+
+RestrictedGetter = RestrictedDefaultGetter
+
 class ListGetter(Method):
   """
   Gets a list of reference objects
@@ -91,6 +109,22 @@
 
   psyco.bind(__call__)
 
+class RestrictedListGetter(ListGetter):
+  """
+  Gets a list of reference objects
+  """
+  def __call__(self, instance, *args, **kw):
+    if self._warning:
+      LOG("ERP5Type Deprecated Getter Id:",0, self._id)
+    return instance._getRelatedPropertyList(
+                      self._key, 'relative_url',
+                      spec=kw.get('spec',()),
+                      filter=kw.get('filter', None),
+                      portal_type=kw.get('portal_type',()),
+                      query=instance.portal_catalog.getSecurityQuery(),)
+
+  psyco.bind(__call__)
+
 class SetGetter(ListGetter):
   """
   Gets a category value set
@@ -99,3 +133,12 @@
     result_list = ListGetter.__call__(self, instance, *args, **kw)
     result_set = dict([(x, 0) for x in result_list]).keys()
     return result_set
+
+class RestrictedSetGetter(RestrictedListGetter):
+  """
+  Gets a category value set
+  """
+  def __call__(self, instance, *args, **kw):
+    result_list = RestrictedListGetter.__call__(self, instance, *args, **kw)
+    result_set = dict([(x, 0) for x in result_list]).keys()
+    return result_set

Modified: erp5/trunk/products/ERP5Type/Accessor/RelatedValue.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Accessor/RelatedValue.py?rev=13435&r1=13434&r2=13435&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Accessor/RelatedValue.py (original)
+++ erp5/trunk/products/ERP5Type/Accessor/RelatedValue.py Thu Mar 15 17:26:17 2007
@@ -26,7 +26,8 @@
 #
 ##############################################################################
 
-from Base import func_code, type_definition, list_types, ATTRIBUTE_PREFIX, Method
+from Base import func_code, type_definition, list_types, \
+                 ATTRIBUTE_PREFIX, Method
 from Products.ERP5Type.PsycoWrapper import psyco
 
 class DefaultGetter(Method):
@@ -67,6 +68,26 @@
 
 Getter = DefaultGetter
 
+class RestrictedDefaultGetter(DefaultGetter):
+  """
+  Gets a default reference object
+  """
+  def __call__(self, instance, *args, **kw):
+    if self._warning:
+      LOG("ERP5Type Deprecated Getter Id:",0, self._id)
+    return instance._getDefaultRelatedValue(
+                            self._key,
+                            spec=kw.get('spec',()),
+                            filter=kw.get('filter', None),
+                            portal_type=kw.get('portal_type',()),
+                            strict_membership=kw.get('strict_membership',
+                            kw.get('strict', None)), # 'strict' is deprecated
+                            query=instance.portal_catalog.getSecurityQuery(),)
+
+  psyco.bind(__call__)
+
+RestrictedGetter = RestrictedDefaultGetter
+
 class ListGetter(Method):
   """
   Gets a list of reference objects
@@ -103,12 +124,39 @@
 
   psyco.bind(__call__)
 
+class RestrictedListGetter(ListGetter):
+  """
+  Gets a list of reference objects
+  """
+  def __call__(self, instance, *args, **kw):
+    if self._warning:
+      LOG("ERP5Type Deprecated Getter Id:",0, self._id)
+    return instance._getRelatedValueList(
+                           self._key,
+                           spec=kw.get('spec',()),
+                           filter=kw.get('filter', None),
+                           portal_type=kw.get('portal_type',()),
+                           strict_membership=kw.get('strict_membership', 
+                           kw.get('strict', None)), # 'strict' is deprecated
+                           query=instance.portal_catalog.getSecurityQuery(),)
+
+  psyco.bind(__call__)
+
 class SetGetter(ListGetter):
   """
   Gets a category value set
   """
   def __call__(self, instance, *args, **kw):
     result_list = ListGetter.__call__(self, instance, *args, **kw)
+    result_set = dict([(x, 0) for x in result_list]).keys()
+    return result_set
+
+class RestrictedSetGetter(RestrictedListGetter):
+  """
+  Gets a category value set
+  """
+  def __call__(self, instance, *args, **kw):
+    result_list = RestrictedListGetter.__call__(self, instance, *args, **kw)
     result_set = dict([(x, 0) for x in result_list]).keys()
     return result_set
 
@@ -146,6 +194,27 @@
   psyco.bind(__call__)
 
 IdGetter = DefaultIdGetter
+
+class RestrictedDefaultIdGetter(DefaultIdGetter):
+  """
+  Gets a default reference object
+  """
+  def __call__(self, instance, *args, **kw):
+    if self._warning:
+      LOG("ERP5Type Deprecated Getter Id:",0, self._id)
+    return instance._getDefaultRelatedProperty(
+                           self._key, 'id',
+                           spec=kw.get('spec',()),
+                           filter=kw.get('filter', None),
+                           portal_type=kw.get('portal_type',()),
+                           strict_membership=kw.get('strict_membership', 
+                           kw.get('strict', None)), # 'strict' is deprecated
+                           query=instance.portal_catalog.getSecurityQuery(),)
+
+
+  psyco.bind(__call__)
+
+RestrictedIdGetter = RestrictedDefaultIdGetter
 
 class IdListGetter(Method):
     """
@@ -179,12 +248,39 @@
 
     psyco.bind(__call__)
 
+class RestrictedIdListGetter(IdListGetter):
+    """
+    Gets a list of reference objects
+    """
+    def __call__(self, instance, *args, **kw):
+      if self._warning:
+        LOG("ERP5Type Deprecated Getter Id:",0, self._id)
+      return instance._getRelatedPropertyList(
+                           self._key, 'id',
+                           spec=kw.get('spec',()),
+                           filter=kw.get('filter', None),
+                           portal_type=kw.get('portal_type',()),
+                           strict_membership=kw.get('strict_membership', 
+                           kw.get('strict', None)), # 'strict' is deprecated
+                           query=instance.portal_catalog.getSecurityQuery(),)
+
+    psyco.bind(__call__)
+
 class IdSetGetter(IdListGetter):
   """
   Gets a category value set
   """
   def __call__(self, instance, *args, **kw):
     result_list = IdListGetter.__call__(self, instance, *args, **kw)
+    result_set = dict([(x, 0) for x in result_list]).keys()
+    return result_set
+
+class RestrictedIdSetGetter(RestrictedIdListGetter):
+  """
+  Gets a category value set
+  """
+  def __call__(self, instance, *args, **kw):
+    result_list = RestrictedIdListGetter.__call__(self, instance, *args, **kw)
     result_set = dict([(x, 0) for x in result_list]).keys()
     return result_set
 
@@ -222,6 +318,26 @@
 
 TitleGetter = DefaultTitleGetter
 
+class RestrictedDefaultTitleGetter(DefaultTitleGetter):
+  """
+  Gets a default reference object
+  """
+  def __call__(self, instance, *args, **kw):
+    if self._warning:
+      LOG("ERP5Type Deprecated Getter Id:",0, self._id)
+    return instance._getDefaultRelatedProperty(
+                         self._key, 'title',
+                         spec=kw.get('spec',()),
+                         filter=kw.get('filter', None),
+                         portal_type=kw.get('portal_type',()),
+                         strict_membership=kw.get('strict_membership', 
+                         kw.get('strict', None)), # 'strict' is deprecated
+                         query=instance.portal_catalog.getSecurityQuery(),)
+
+  psyco.bind(__call__)
+
+RestrictedTitleGetter = RestrictedDefaultTitleGetter
+
 class TitleListGetter(Method):
   """
   Gets a list of reference objects
@@ -253,12 +369,40 @@
                         kw.get('strict', None))) # 'strict' is deprecated
   psyco.bind(__call__)
 
+class RestrictedTitleListGetter(TitleListGetter):
+  """
+  Gets a list of reference objects
+  """
+  def __call__(self, instance, *args, **kw):
+    if self._warning:
+      LOG("ERP5Type Deprecated Getter Id:",0, self._id)
+    return instance._getRelatedPropertyList(
+                        self._key, 'title',
+                        spec=kw.get('spec',()),
+                        filter=kw.get('filter', None),
+                        portal_type=kw.get('portal_type',()),
+                        strict_membership=kw.get('strict_membership', 
+                        kw.get('strict', None)), # 'strict' is deprecated
+                        query=instance.portal_catalog.getSecurityQuery(),)
+
+  psyco.bind(__call__)
+
 class TitleSetGetter(TitleListGetter):
   """
   Gets a category value set
   """
   def __call__(self, instance, *args, **kw):
     result_list = TitleListGetter.__call__(self, instance, *args, **kw)
+    result_set = dict([(x, 0) for x in result_list]).keys()
+    return result_set
+
+class RestrictedTitleSetGetter(RestrictedTitleListGetter):
+  """
+  Gets a category value set
+  """
+  def __call__(self, instance, *args, **kw):
+    result_list = RestrictedTitleListGetter.__call__(self, instance, 
+                                                     *args, **kw)
     result_set = dict([(x, 0) for x in result_list]).keys()
     return result_set
 
@@ -295,6 +439,26 @@
 
 PropertyGetter = DefaultPropertyGetter
 
+class RestrictedDefaultPropertyGetter(DefaultPropertyGetter):
+  """
+  Gets a default reference object
+  """
+  def __call__(self, instance, key, *args, **kw):
+    if self._warning:
+      LOG("ERP5Type Deprecated Getter Id:",0, self._id)
+    return instance._getDefaultRelatedProperty(
+                         self._key, key,
+                         spec=kw.get('spec',()),
+                         filter=kw.get('filter', None),
+                         portal_type=kw.get('portal_type',()),
+                         strict_membership=kw.get('strict_membership', 
+                         kw.get('strict', None)), # 'strict' is deprecated
+                         query=instance.portal_catalog.getSecurityQuery(),)
+
+  psyco.bind(__call__)
+
+RestrictedPropertyGetter = RestrictedDefaultPropertyGetter
+
 class PropertyListGetter(Method):
   """
   Gets a list of reference objects
@@ -326,6 +490,24 @@
                            kw.get('strict', None))) # 'strict' is deprecated
   psyco.bind(__call__)
 
+class RestrictedPropertyListGetter(PropertyListGetter):
+  """
+  Gets a list of reference objects
+  """
+  def __call__(self, instance, key, *args, **kw):
+    if self._warning:
+      LOG("ERP5Type Deprecated Getter Id:",0, self._id)
+    return instance._getRelatedPropertyList(
+                           self._key, key,
+                           spec=kw.get('spec',()),
+                           filter=kw.get('filter', None),
+                           portal_type=kw.get('portal_type',()),
+                           strict_membership=kw.get('strict_membership', 
+                           kw.get('strict', None)), # 'strict' is deprecated
+                           query=instance.portal_catalog.getSecurityQuery(),)
+
+  psyco.bind(__call__)
+
 class PropertySetGetter(PropertyListGetter):
   """
   Gets a category value set
@@ -335,3 +517,13 @@
     result_set = dict([(x, 0) for x in result_list]).keys()
     return result_set
 
+class RestrictedPropertySetGetter(RestrictedPropertyListGetter):
+  """
+  Gets a category value set
+  """
+  def __call__(self, instance, *args, **kw):
+    result_list = RestrictedPropertyListGetter.__call__(self, instance, 
+                                                        *args, **kw)
+    result_set = dict([(x, 0) for x in result_list]).keys()
+    return result_set
+




More information about the Erp5-report mailing list