--- a/preferences.py Mon Feb 09 22:17:10 2009 +0200
+++ b/preferences.py Mon Feb 09 23:49:57 2009 +0200
@@ -195,6 +195,7 @@
# now for our defined preferences....
import pytz
+import config
class TimeFormat (urltree.URLStringType, Preference) :
"""
@@ -205,7 +206,7 @@
name = 'time_format'
# default value
- default = "%H:%M:%S"
+ default = config.PREF_TIME_FMT_DEFAULT
class DateFormat (urltree.URLStringType, Preference) :
"""
@@ -216,7 +217,7 @@
name = 'date_format'
# default value
- default = "%Y-%m-%d"
+ default = config.PREF_DATE_FMT_DEFAULT
class Timezone (Preference) :
"""
@@ -227,7 +228,7 @@
name = 'timezone'
# default value is UTC...
- default = pytz.utc
+ default = config.PREF_TIMEZONE_DEFAULT
def parse (self, name) :
"""
@@ -280,18 +281,32 @@
return fmt_cls(prefs[timezone], prefs[time_format])
-# and then build the Preferences object
-import log_formatter
+class Count (urltree.URLIntegerType, Preference) :
+ """
+ Number of lines of log data to display per page
+ """
-time_format = TimeFormat()
-date_format = DateFormat()
-timezone = Timezone()
-formatter = Formatter(log_formatter.FORMATTERS, log_formatter.IrssiFormatter)
+ # set name
+ name = "count"
+
+ # default
+ default = config.PREF_COUNT_DEFAULT
+
+ def __init__ (self) :
+ super(Count, self).__init__(allow_negative=False, allow_zero=False, max=config.PREF_COUNT_MAX)
+
+# and then build the Preferences object
+time_format = TimeFormat()
+date_format = DateFormat()
+timezone = Timezone()
+formatter = Formatter(config.LOG_FORMATTERS, config.PREF_FORMATTER_DEFAULT)
+count = Count()
preferences = Preferences([
time_format,
date_format,
timezone,
formatter,
+ count,
])