Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #830 (closed defect: fixed)

Opened 13 years ago

Last modified 12 years ago

Widget.template does not allow to omit package name

Reported by: max Owned by: alberto
Priority: high Milestone: 1.5
Component: TG Widgets Version: 0.9a6
Severity: normal Keywords:


Widgets.template does not allow to omit package name, unlike turbogears.expose() function. This inconsistency is confusing to the user and can be seen as a bug.

Attempt to omit package name, like Widget(template=".templates.something") gives the following traceback:

Module turbokid.kidsupport:68 in load_template         
         if not self.options.get("kid.precompiled", False):
                tfile = pkg_resources.resource_filename(package,
                                                        "%s.kid" % basename)
                ct = self.compiled_templates
                if sys.modules.has_key(classname) and ct.has_key(classname):>>  "%s.kid" % basename)
Module pkg_resources:799 in resource_filename        
     def resource_filename(self, package_or_requirement, resource_name):
            """Return a true filesystem path for specified resource"""
            return get_provider(package_or_requirement).get_resource_filename(
                self, resource_name
            )>>  return get_provider(package_or_requirement).get_resource_filename(
Module pkg_resources:119 in get_provider        
<<          module = sys.modules[moduleOrReq]
        except KeyError:
            module = sys.modules[moduleOrReq]
        loader = getattr(module, '__loader__', None)>>  __import__(moduleOrReq)
exceptions.ValueError: ('Empty module name', <function _wrapper at 0x0180EFB0>)

Change History

comment:1 Changed 13 years ago by alberto

  • Owner changed from anonymous to alberto
  • Version changed from 0.9a5 to 0.9a6

This shouldn't be too hard, I'll assign it to meself ;)

comment:2 Changed 13 years ago by khorn

  • Milestone 1.0b1 deleted

milestone passed, removing milestone

comment:3 Changed 13 years ago by jorge.vargas

  • Priority changed from normal to high
  • Milestone set to 1.0

this needs a fix before 1.0, or at least a document pointing out the difference and a explanation

comment:4 Changed 13 years ago by alberto

#1086 (committed at trunk) addresses this as it uses the engine's load_template which is the same mechanism for loading templates that expose uses. It should apply cleanly to 1.0 if it really needs a fix before 1.0.

comment:5 Changed 13 years ago by alberto

  • Milestone changed from 1.0 to 1.1

comment:6 Changed 12 years ago by jorge.vargas

  • Status changed from new to closed
  • Resolution set to fixed

based on alberto's comment this should be done.

Note: See TracTickets for help on using tickets.