[Mpuls-commits] r3137 - in base/trunk: . mpulsweb/controllers mpulsweb/lib
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Jul 6 09:07:10 CEST 2010
Author: roland
Date: 2010-07-06 09:07:08 +0200 (Tue, 06 Jul 2010)
New Revision: 3137
Modified:
base/trunk/ChangeLog
base/trunk/mpulsweb/controllers/navigation.py
base/trunk/mpulsweb/lib/helpers.py
Log:
Issue 804: round *down* to the nearest multiple of 5
Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog 2010-07-05 10:18:16 UTC (rev 3136)
+++ base/trunk/ChangeLog 2010-07-06 07:07:08 UTC (rev 3137)
@@ -1,3 +1,8 @@
+2010-07-06 Roland Geider <roland.geider at intevation.de>
+
+ * mpulsweb/lib/helpers.py: Issue 804: round *down* to the nearest
+ multiple of 5.
+
2010-07-02 Bernhard Herzog <bh at intevation.de>
* mpulsweb/model/case.py (MpulsCase.setEditor, MpulsCase.delete):
Modified: base/trunk/mpulsweb/controllers/navigation.py
===================================================================
--- base/trunk/mpulsweb/controllers/navigation.py 2010-07-05 10:18:16 UTC (rev 3136)
+++ base/trunk/mpulsweb/controllers/navigation.py 2010-07-06 07:07:08 UTC (rev 3137)
@@ -46,6 +46,21 @@
def index(self):
raise HTTPNotFound()
+ def open_all_branches(self, tree=None):
+ self.navigation = session['navigation.tree']
+ if tree == None:
+ tree = self.navigation.getAllItems()
+ for branch in tree:
+ if branch.is_child():
+ print "branch %s - %s is a leaf, skipping..." % (branch.name, branch.description)
+ pass
+ else:
+ print "branch %s - %s is a node, opening..." % (branch.name, branch.description)
+ self.open_all_branches(branch)
+ pass
+ #print branch
+
+
def open_branch(self, id):
self.navigation = session['navigation.tree']
tree_item = self.navigation.getTreeItem(id)
Modified: base/trunk/mpulsweb/lib/helpers.py
===================================================================
--- base/trunk/mpulsweb/lib/helpers.py 2010-07-05 10:18:16 UTC (rev 3136)
+++ base/trunk/mpulsweb/lib/helpers.py 2010-07-06 07:07:08 UTC (rev 3137)
@@ -235,14 +235,14 @@
def format_time(dt, approximate=False):
"""
Format time with the correct locale. If the optional parameter "approximate"
- is set, the minutes will be rounded to the next multiple of 5
+ is set, the minutes will be rounded to the previous multiple of 5
"""
if dt is None:
return ''
try:
cs = locale.nl_langinfo(locale.CODESET)
if approximate:
- dt = dt.replace(minute = int(5 * round(float(dt.minute)/5)))
+ dt = dt.replace(minute = int(5 * (dt.minute/5)))
return unicode(dt.strftime('%H:%M'), cs)
except Exception, err:
log.error(err)
More information about the Mpuls-commits
mailing list