Author: eallen
Date: 2008-08-13 18:20:39 -0400 (Wed, 13 Aug 2008)
New Revision: 2300
Modified:
mgmt/trunk/cumin/python/cumin/widgets.py
Log:
Added generic TextField
Implemented logic to use the required attribute of NameField
Modified: mgmt/trunk/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.py 2008-08-13 22:04:16 UTC (rev 2299)
+++ mgmt/trunk/cumin/python/cumin/widgets.py 2008-08-13 22:20:39 UTC (rev 2300)
@@ -594,10 +594,13 @@
def render_title(self, session):
return "Name"
+ def set_required(self, required):
+ self.required = required
+
def do_validate(self, session, errors):
name = self.get(session)
- if name == "":
+ if name == "" and self.required:
errors.append(MissingValueError())
else:
for char in self.illegal_chars:
@@ -610,6 +613,18 @@
break
+class TextField(NameField):
+ def __init__(self, app, name, form):
+ super(TextField, self).__init__(app, name, form)
+
+ self.__title = "Title"
+
+ def set_title(self, title):
+ self.__title = title
+
+ def render_title(self, session):
+ return self.__title
+
class ExchangeNameField(NameField):
def __init__(self, app, name, form):
super(ExchangeNameField, self).__init__(app, name, form)
Show replies by date