app/soc/logic/models/base.py
changeset 679 77a286ff6667
parent 673 2433d5c1d7e6
child 689 46db8c4bbffc
--- a/app/soc/logic/models/base.py	Sat Dec 06 14:23:25 2008 +0000
+++ b/app/soc/logic/models/base.py	Sat Dec 06 14:23:53 2008 +0000
@@ -77,6 +77,18 @@
 
     return self._scope_logic
 
+  def getScopeDepth(self):
+    """Returns the scope depth for this entity
+
+    Returns None if any of the parent scopes return None
+    """
+
+    if not self._scope_logic:
+      return 0
+
+    depth = self._scope_logic.logic.getScopeDepth()
+    return None if (depth is None) else (depth + 1)
+
   def _updateField(self, model, name, value):
     """Hook called when a field is updated.