Permalink
Browse files

2.1.0a4 - Fix bug in automatic resource registration.

Reversed the lie I told myself in the test suite as well.
  • Loading branch information...
ralphbean committed May 27, 2012
1 parent c822b2a commit efcd51724cb4bd7360ece576d9cc195c442c8944
Showing with 7 additions and 8 deletions.
  1. +1 −1 setup.py
  2. +3 −4 tests/test_resources.py
  3. +3 −3 tw2/core/resources.py
@@ -51,7 +51,7 @@ def get_description(fname='README.rst'):
setup(
name='tw2.core',
version='2.1.0a3',
version='2.1.0a4',
description="Web widget creation toolkit based on TurboGears widgets",
long_description = get_description(),
install_requires=requires,
@@ -284,7 +284,6 @@ def test_find_charset():
class TestResourcesMisc(TestCase):
real_modname = 'nose.importer'
def testJSSymbol(self):
"""
@@ -319,19 +318,19 @@ def testLinkHash(self):
def testAutoModname(self):
l = twr.Link(filename="somefile")
eq_(l.modname, self.real_modname)
eq_(l.modname, __name__)
def testAutoModnameReqPrep(self):
l = twr.Link(filename="somefile")
l = l.req()
l.prepare()
eq_(l.modname, self.real_modname)
eq_(l.modname, __name__)
def testAutoModnameInject(self):
l = twr.Link(filename="somefile")
l.inject()
local = tw2.core.core.request_local()
eq_(local['resources'][0].modname, self.real_modname)
eq_(local['resources'][0].modname, __name__)
def testDirLink(self):
dl = twr.DirLink(modname="tw2.core", filename="somefile")
@@ -140,13 +140,13 @@ def guess_modname(cls):
@classmethod
def post_define(cls):
if not cls.modname:
cls.modname = cls.guess_modname()
if not cls.no_inject:
if getattr(cls, 'filename', None) and \
type(cls.filename) != property:
if not cls.modname:
cls.modname = cls.guess_modname()
md.register_resource(
cls.modname or '__anon__', cls.filename, cls.whole_dir
)

0 comments on commit efcd517

Please sign in to comment.