[Mpuls-commits] r3266 - base/trunk/mpulsweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Jul 29 12:16:08 CEST 2010


Author: torsten
Date: 2010-07-29 12:16:07 +0200 (Thu, 29 Jul 2010)
New Revision: 3266

Modified:
   base/trunk/mpulsweb/lib/renderer.py
Log:
* mpulsweb/lib/renderer.py (get_child_num): New. Function which returns the
  position of a given child in the sequence of its siblings.


Modified: base/trunk/mpulsweb/lib/renderer.py
===================================================================
--- base/trunk/mpulsweb/lib/renderer.py	2010-07-29 10:14:59 UTC (rev 3265)
+++ base/trunk/mpulsweb/lib/renderer.py	2010-07-29 10:16:07 UTC (rev 3266)
@@ -72,7 +72,14 @@
         c = c.parent
     return depth
 
+def get_child_num(child):
+    '''Returns which place in sequence of the children the given child is'''
+    parent = child.parent
+    for num, c in enumerate(parent.children):
+        if c.getIdentifier() == child.getIdentifier(): return num+1
+    return 0
 
+
 def hidden_bool_tag(id):
     """Return the hidden HTML input tag for the plain boolean field given by id.
 



More information about the Mpuls-commits mailing list