[rhmessaging-commits] rhmessaging commits: r1615 - in mgmt/cumin/python: wooly and 1 other directory.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Sun Jan 27 15:09:44 EST 2008
Author: justi9
Date: 2008-01-27 15:09:44 -0500 (Sun, 27 Jan 2008)
New Revision: 1615
Modified:
mgmt/cumin/python/cumin/formats.py
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/wooly/__init__.py
mgmt/cumin/python/wooly/pages.py
mgmt/cumin/python/wooly/resources.py
mgmt/cumin/python/wooly/tables.py
Log:
Resolve some XXX cleanup items.
Modified: mgmt/cumin/python/cumin/formats.py
===================================================================
--- mgmt/cumin/python/cumin/formats.py 2008-01-27 20:08:47 UTC (rev 1614)
+++ mgmt/cumin/python/cumin/formats.py 2008-01-27 20:09:44 UTC (rev 1615)
@@ -14,7 +14,6 @@
return tstamp
-# XXX change this to millis or nanos? whatever python wants to give us
def fmt_duration(secs):
"""Takes a duration in seconds, which can be a float"""
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2008-01-27 20:08:47 UTC (rev 1614)
+++ mgmt/cumin/python/cumin/model.py 2008-01-27 20:09:44 UTC (rev 1615)
@@ -2,6 +2,7 @@
from wooly import *
from time import mktime
from datetime import datetime, timedelta
+from types import *
from util import *
from formats import *
@@ -129,8 +130,10 @@
text = ""
elif value == 0:
text = "0"
+ elif isinstance(value, IntType) or isinstance(value, LongType):
+ text = "%i" % value
else:
- text = "%i" % value # XXX handle other types
+ text = "%r" % value
return text
Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py 2008-01-27 20:08:47 UTC (rev 1614)
+++ mgmt/cumin/python/wooly/__init__.py 2008-01-27 20:09:44 UTC (rev 1615)
@@ -92,8 +92,8 @@
class Widget(object):
def __init__(self, app, name):
self.app = app
- self.name = name # XXX undo this
- self.parent = None # XXX undo this
+ self.name = name
+ self.parent = None
self.children = list()
self.attributes = list()
self.parameters = list()
@@ -408,8 +408,6 @@
self.parameter_index = None
self.finder = ResourceFinder()
- self.cached_css = None
- self.cached_javascript = None
self.debug = None
@@ -477,54 +475,12 @@
def get_resource(self, name):
return self.finder.find(name)
- # XXX move this to CssPage
- def get_css(self):
- if not self.cached_css:
- writer = Writer()
-
- for cls in sorted(self.widget_classes):
- strs = cls.get_module_strings()
-
- if strs:
- css = strs.get(cls.__name__ + ".css")
-
- if css:
- writer.write(css)
- writer.write("\r\n") # HTTP newline
-
- self.cached_css = writer.to_string()
-
- return self.cached_css
-
- def get_javascript(self):
- if not self.cached_javascript:
- writer = Writer()
-
- for cls in sorted(self.widget_classes):
- strs = cls.get_module_strings()
-
- if strs:
- javascript = strs.get(cls.__name__ + ".javascript")
-
- if javascript:
- writer.write(javascript)
- writer.write("\r\n")
-
- self.cached_javascript = writer.to_string()
-
- return self.cached_javascript
-
- def clear_caches(self):
- self.cached_css = None
- self.cached_javascript = None
-
class Session(object):
def __init__(self, app, trunk=None):
self.app = app
self.trunk = trunk
self.page = None
self.values = dict()
- self.errors = dict() # widget => list of str # XXX remove this
if self.app.debug:
self.debug = self.Debug(self)
Modified: mgmt/cumin/python/wooly/pages.py
===================================================================
--- mgmt/cumin/python/wooly/pages.py 2008-01-27 20:08:47 UTC (rev 1614)
+++ mgmt/cumin/python/wooly/pages.py 2008-01-27 20:09:44 UTC (rev 1615)
@@ -1,36 +1,74 @@
from datetime import datetime
-from wooly import Page, Parameter
+from wooly import Page, Parameter, Writer
class CssPage(Page):
def __init__(self, app, name):
super(CssPage, self).__init__(app, name)
- self.then = datetime.utcnow()
+ self.__then = datetime.utcnow()
+ self.__css = None
def get_last_modified(self, session):
- return self.then
+ return self.__then
def get_content_type(self, session):
return "text/css"
+ def get_css(self):
+ if not self.__css:
+ writer = Writer()
+
+ for cls in sorted(self.app.widget_classes):
+ strs = cls.get_module_strings()
+
+ if strs:
+ css = strs.get(cls.__name__ + ".css")
+
+ if css:
+ writer.write(css)
+ writer.write("\r\n") # HTTP newline
+
+ self.__css = writer.to_string()
+
+ return self.__css
+
def do_render(self, session, object):
- return self.app.get_css()
+ return self.get_css()
class JavascriptPage(Page):
def __init__(self, app, name):
super(JavascriptPage, self).__init__(app, name)
- self.then = datetime.utcnow()
+ self.__then = datetime.utcnow()
+ self.__javascript = None
def get_last_modified(self, session):
- return self.then
+ return self.__then
def get_content_type(self, session):
return "text/javascript"
+ def get_javascript(self):
+ if not self.__javascript:
+ writer = Writer()
+
+ for cls in sorted(self.app.widget_classes):
+ strs = cls.get_module_strings()
+
+ if strs:
+ javascript = strs.get(cls.__name__ + ".javascript")
+
+ if javascript:
+ writer.write(javascript)
+ writer.write("\r\n")
+
+ self.__javascript = writer.to_string()
+
+ return self.__javascript
+
def do_render(self, session, object):
- return self.app.get_javascript()
+ return self.get_javascript()
class ResourcePage(Page):
def __init__(self, app, name):
Modified: mgmt/cumin/python/wooly/resources.py
===================================================================
--- mgmt/cumin/python/wooly/resources.py 2008-01-27 20:08:47 UTC (rev 1614)
+++ mgmt/cumin/python/wooly/resources.py 2008-01-27 20:09:44 UTC (rev 1615)
@@ -13,7 +13,6 @@
try:
file = open(self.path)
self.strings = parse_catalog_file(file)
- # XXX catch file not found
finally:
file.close()
Modified: mgmt/cumin/python/wooly/tables.py
===================================================================
--- mgmt/cumin/python/wooly/tables.py 2008-01-27 20:08:47 UTC (rev 1614)
+++ mgmt/cumin/python/wooly/tables.py 2008-01-27 20:09:44 UTC (rev 1615)
@@ -39,7 +39,7 @@
def is_reversed(self, session):
return self.reversed.get(session)
- def get_items(self, session, object):
+ def do_get_items(self, session, object):
"""Gets the rows"""
return None
@@ -224,8 +224,7 @@
return data[0]
- # XXX shouldn't this be do_get_items?
- def get_items(self, session, object):
+ def do_get_items(self, session, object):
conn = self.get_connection(session)
if conn:
More information about the rhmessaging-commits
mailing list