Module: check_mk
Branch: master
Commit: 1ddfc677c89797212e39a7ad4503133470bcc13e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1ddfc677c89797…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Sep 4 16:57:06 2012 +0200
Fixed caching bug in AutoTimestamp ValueSpec
---
web/htdocs/valuespec.py | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index bcb9242..f05add8 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -1903,11 +1903,20 @@ class ElementSelection(ValueSpec):
class AutoTimestamp(FixedValue):
def __init__(self, **kwargs):
ValueSpec.__init__(self, **kwargs)
- self._value = time.time()
+
+ def canonical_value(self):
+ return time.time()
+
+ def from_html_vars(self, varprefix):
+ return time.time()
def value_to_text(self, value):
return time.strftime("%F %T", time.localtime(value))
+ def validate_datatype(self, value, varprefix):
+ if type(value) not in [ int, float ]:
+ return MKUserError(varprefix, _("Invalid datatype of timestamp: must be
int or float."))
+
# Fully transparant VS encapsulating a vs in a foldable
# container.
class Foldable(ValueSpec):