Author: justi9
Date: 2010-07-06 15:19:04 -0400 (Tue, 06 Jul 2010)
New Revision: 4082
Modified:
mgmt/newdata/rosemary/python/rosemary/model.py
Log:
Generate better approximations of human-readable titles
Modified: mgmt/newdata/rosemary/python/rosemary/model.py
===================================================================
--- mgmt/newdata/rosemary/python/rosemary/model.py 2010-07-06 18:32:53 UTC (rev 4081)
+++ mgmt/newdata/rosemary/python/rosemary/model.py 2010-07-06 19:19:04 UTC (rev 4082)
@@ -293,7 +293,7 @@
log.debug("Initializing %s", self)
if not self._title:
- self._title = self._name
+ self._title = generate_title(self._name)
for hdr in self._headers:
hdr.init()
@@ -506,7 +506,7 @@
def init(self):
if not self.title:
- self.title = self.name
+ self.title = generate_title(self.name)
def __repr__(self):
args = (self.__class__.__name__, self.cls._name, self.name)
@@ -703,3 +703,17 @@
class RosemaryNotFound(Exception):
pass
+
+def generate_title(name):
+ assert name
+
+ chars = list()
+ chars.append(name[0].upper())
+
+ for char in name[1:]:
+ if char.isupper():
+ chars.append(" ")
+
+ chars.append(char)
+
+ return "".join(chars)
Show replies by date