--- a/branches/1.1/turbogears/view/base.py
+++ b/branches/1.1/turbogears/view/base.py
@@ -8,12 +8,14 @@
 from urllib import quote_plus
 
 import cherrypy
+import genshi
 import pkg_resources
 
 import turbogears
 from turbogears import identity, config
 from turbogears.i18n import i18n_filter, get_locale
-from turbogears.util import DictObj, DictWrapper, get_template_encoding_default, adapt_call
+from turbogears.util import Bunch, get_template_encoding_default, \
+    adapt_call, deprecated
 
 log = logging.getLogger("turbogears.view")
 
@@ -22,27 +24,22 @@
 root_variable_providers = []
 engines = dict()
 
-# Deprecation of variableProviders
-def print_warning(func):
-    def _print_warning(*args, **kw):
-        import warnings
-        warnings.warn(
-            "Use of variableProviders is deprecated, use variable_providers"
-            "instead.",
-            DeprecationWarning, 2)
-        return func(*args, **kw)
-    return _print_warning
 
 class MetaDeprecatedVariableProviders(type):
+
     def __new__(cls, name, bases, dict):
-        for (key, value) in dict.items():
+        deprecate = deprecated(
+            "Use variable_providers instead of variableProviders.")
+        for key, value in dict.items():
             if key == "__metaclass__":
                 continue
             if callable(value):
-                dict[key] = print_warning(value)
+                dict[key] = deprecate(value)
         return type.__new__(cls, name, bases, dict)
 
+
 class DeprecatedVariableProviders(list):
+
     __metaclass__ = MetaDeprecatedVariableProviders
 
     def append(self, *args, **kw):
@@ -73,6 +70,7 @@
         super(DeprecatedVariableProviders, self).sort(*args, **kw)
 
 variableProviders = DeprecatedVariableProviders()
+
 
 def _choose_engine(template):
     if isinstance(template, basestring):
@@ -94,7 +92,8 @@
     return engine, template, enginename
 
 
-def render(info, template=None, format=None, content_type=None, mapping=None, fragment=False):
+def render(info, template=None, format=None, content_type=None,
+        mapping=None, fragment=False):
     """Renders data in the desired format.
 
     @param info: the data itself
@@ -106,6 +105,7 @@
     @type fragment: bool
     @param template: name of the template to use
     @type template: string
+
     """
     template = info.pop("tg_template", template)
     if not info.has_key("tg_flash"):
@@ -125,19 +125,24 @@
     if not format:
         format = config.get("%s.outputformat" % enginename, "html")
     args, kw = adapt_call(engine.render, args= [],
-                kw = dict(info=info, format=format, fragment=fragment, template=template, mapping=mapping), start=1)
+        kw = dict(info=info, format=format, fragment=fragment,
+        template=template, mapping=mapping), start=1)
     return engine.render(**kw)
 
+
 def transform(info, template):
-    "Create ElementTree representation of the output"
+    """Create ElementTree representation of the output."""
     engine, template, enginename = _choose_engine(template)
     return engine.transform(info, template)
 
+
 def loadBaseTemplates():
-    """Loads base templates for use by other templates.
-    By listing templates in turbogears.view.baseTemplates, these templates will
-    automatically be loaded so that the "import" statement in a template
-    will work.
+    """Load base templates for use by other templates.
+
+    By listing templates in turbogears.view.baseTemplates,
+    these templates will automatically be loaded so that
+    the "import" statement in a template will work.
+
     """
     log.debug("Loading base templates")
     for template in baseTemplates:
@@ -146,62 +151,61 @@
             del sys.modules[template]
         engine.load_template(template)
 
-NOTGIVEN = []
 
 class cycle:
-    """
-    Loops forever over an iterator. Wraps the itertools.cycle method
-    but provides a way to get the current value via the 'value' attribute
-
-    >>> from turbogears.view.base import cycle
-    >>> oe = cycle(('odd','even'))
-    >>> oe
-    None
-    >>> oe.next()
-    'odd'
-    >>> oe
-    'odd'
-    >>> oe.next()
-    'even'
-    >>> oe.next()
-    'odd'
-    >>> oe.value
-    'odd'
+    """Loops forever over an iterator.
+
+    Wraps the itertools.cycle method, but provides a way to get the current
+    value via the 'value' attribute.
+
     """
     value = None
+
     def __init__(self, iterable):
         self._cycle = icycle(iterable)
+
     def __str__(self):
         return self.value.__str__()
+
     def __repr__(self):
         return self.value.__repr__()
+
     def next(self):
         self.value = self._cycle.next()
         return self.value
 
 
 def selector(expression):
-    """If the expression is true, return the string 'selected'. Useful for
-    HTML <option>s."""
+    """If the expression is true, return the string 'selected'.
+
+    Useful for HTML <option>s.
+
+    """
     if expression:
         return "selected"
     else:
         return None
 
+
 def checker(expression):
-    """If the expression is true, return the string "checked". This is useful
-    for checkbox inputs.
+    """If the expression is true, return the string "checked".
+
+    This is useful for checkbox inputs.
+
     """
     if expression:
         return "checked"
     else:
         return None
 
+
 def ipeek(it):
-    """Lets you look at the first item in an iterator. This is a good way
-    to verify that the iterator actually contains something. This is useful
-    for cases where you will choose not to display a list or table if there
-    is no data present.
+    """Lets you look at the first item in an iterator.
+
+    This is a good way to verify that the iterator actually contains something.
+    This is useful for cases where you will choose not to display a list or
+    table if there is no data present.
+
     """
     it = iter(it)
     try:
@@ -210,16 +214,18 @@
     except StopIteration:
         return None
 
-safariua = re.compile(r"Safari/(\d+)")
 
 class UserAgent:
     """Representation of the user's browser.
 
-    Provides information about the type of browser, browser version,
-    etc. This currently contains only the information needed for work
-    thus far. (msie, firefox, safari browser types, plus safari version
-    info.)
-    """
+    Provides information about the type of browser, browser version, etc.
+    This currently contains only the information needed for work thus far
+    (msie, firefox, safari browser types, plus safari version info).
+
+    """
+
+    _re_safari = re.compile(r"Safari/(\d+)")
+
     def __init__(self, useragent=None):
         self.majorVersion = None
         self.minorVersion = None
@@ -230,7 +236,7 @@
         elif useragent.find("Firefox") > -1:
             self.browser = "firefox"
         else:
-            isSafari = safariua.search(useragent)
+            isSafari = self._re_safari.search(useragent)
             if isSafari:
                 self.browser = "safari"
                 build = int(isSafari.group(1))
@@ -253,27 +259,28 @@
             else:
                 self.browser = "unknown: %s" % useragent
 
-class DeprecatedDictWrapper(DictWrapper):
+
+class DeprecatedBunch(Bunch):
     """Wraps access with a deprecation warning."""
 
     def __getattr__(self,name):
         import warnings
-        warnings.warn(
-            "The use of 'std' inside your templates is deprecated,"
-            " use 'tg' instead.",
+        warnings.warn("Use 'tg' instead of 'std' inside your templates.",
             DeprecationWarning, 2)
-        return super(DeprecatedDictWrapper, self).__getattr__(name)
-
-import genshi
+        return super(DeprecatedBunch, self).__getattr__(name)
+
+
 def genshi_et(input):
     if hasattr(input, 'tag'):
         return genshi.input.ET(input)
     else:
         return input
 
+
 def stdvars():
-    """Creates an DictObj with variables that should be available in all
-    templates. These variables are:
+    """Create a Bunch of variables that should be available in all templates.
+
+    These variables are:
 
     useragent
         a UserAgent object with information about the browser
@@ -309,9 +316,9 @@
         the cherrypy config get function
 
     Additionally, you can add a callable to turbogears.view.variable_providers
-    that can add more variables to this list. The callable will be
-    called with the vars DictObj after these standard variables have
-    been set up.
+    that can add more variables to this list. The callable will be called with
+    the vars Bunch after these standard variables have been set up.
+
     """
     try:
         useragent = cherrypy.request.headers["User-Agent"]
@@ -324,7 +331,7 @@
     else:
         session = None
 
-    vars = DictObj(
+    vars = Bunch(
         useragent=useragent, selector=selector,
         tg_js="/" + turbogears.startup.webpath + "tg_js",
         tg_toolbox="/" + turbogears.startup.webpath + "tg_toolbox",
@@ -339,7 +346,7 @@
         request = cherrypy.request)
     for provider in variable_providers + variableProviders:
         provider(vars)
-    deprecated_vars = DeprecatedDictWrapper(vars)
+    deprecated_vars = DeprecatedBunch(vars)
     root_vars = dict()
     for provider in root_variable_providers:
         provider(root_vars)
@@ -347,6 +354,7 @@
     root_vars['ET'] = genshi_et
     return root_vars
 
+
 def load_engines():
     """Load and initialize all templating engines.
 
@@ -355,25 +363,23 @@
     the engines will then be reloaded with the custom configuration later.
 
     """
-    conf = turbogears.config.get
+    get = config.get
     engine_options = {
-        "cheetah.importhooks": conf("cheetah.importhooks", False),
-        "cheetah.precompiled": conf("cheetah.precompiled", False),
-        "genshi.encoding": conf("genshi.encoding", "utf-8"),
-        "genshi.default_doctype": conf("genshi.default_doctype", None),
-        "genshi.lookup_errors": conf("genshi.lookup_errors", "strict"),
-        "genshi.loader_callback" : config.get("genshi.loader_callback", None),
-        "kid.encoding": conf("kid.encoding", "utf-8"),
-        "kid.assume_encoding": conf("kid.assume_encoding", "utf-8"),
-        "kid.precompiled": conf("kid.precompiled", False),
-        "kid.i18n.run_template_filter":
-            conf("i18n.run_template_filter", False),
+        "cheetah.importhooks": get("cheetah.importhooks", False),
+        "cheetah.precompiled": get("cheetah.precompiled", False),
+        "genshi.encoding": get("genshi.encoding", "utf-8"),
+        "genshi.default_doctype": get("genshi.default_doctype", None),
+        "genshi.lookup_errors": get("genshi.lookup_errors", "strict"),
+        "genshi.loader_callback" : get("genshi.loader_callback", None),
+        "kid.encoding": get("kid.encoding", "utf-8"),
+        "kid.assume_encoding": get("kid.assume_encoding", "utf-8"),
+        "kid.precompiled": get("kid.precompiled", False),
+        "kid.i18n.run_template_filter": get("i18n.run_template_filter", False),
         "kid.i18n_filter": i18n_filter,
-        "kid.sitetemplate": conf("tg.sitetemplate",
-            "turbogears.view.templates.sitetemplate"),
-        "kid.reloadbases": conf("kid.reloadbases", False),
-        "mako.directories": conf("mako.directories", []),
-        "mako.output_encoding": conf("mako.output_encoding", "utf-8")
+        "kid.sitetemplate": get("tg.sitetemplate", "turbogears.view.templates.sitetemplate"),
+        "kid.reloadbases": get("kid.reloadbases", False),
+        "mako.directories": get("mako.directories", []),
+        "mako.output_encoding": get("mako.output_encoding", "utf-8")
     }
     for entrypoint in pkg_resources.iter_entry_points(
             "python.templating.engines"):