Loading ...
Sorry, an error occurred while loading the content.

Re: [Cheetahtemplate-discuss] namemapper problem

Expand Messages
  • Tavis Rudd
    Hi Marco, I m interested in your patches. I assume they also work under c-python. Cheers, Tavis ... SF.Net is sponsored by: Speed Start Your Linux Apps Now.
    Message 1 of 3 , Feb 26, 2004
    • 0 Attachment
      Hi Marco,
      I'm interested in your patches. I assume they also work under c-python.
      Cheers,
      Tavis

      On Friday 20 February 2004 13:54, marco wrote:
      > thank's mike,
      >
      > for your help.
      >
      > i have changed the method pragmatically to:
      >
      > def valueForKey(obj, key):
      >
      > """Get the value of the specified key. The 'obj' can be a a
      > mapping or any Python object that supports the __getattr__ method. The key
      > can be a mapping item, or an attribute."""
      > if hasattr(obj, key):
      > at = getattr(obj, key)
      > if type(obj) == types.DictType and key == 'update':
      > # update is'nt allowed as attribute for dictionaries
      > pass
      > else:
      > return at
      > if hasattr(obj, '__getitem__'):
      > try:
      > return obj[key]
      > except KeyError:
      > raise NotFound, key
      > elif hasattr(obj, 'has_key'):
      > try:
      > return obj[key]
      > except KeyError:
      > raise NotFound, key
      > else:
      > raise NotFound, key
      >
      > and all test are running.
      >
      > additional i have changed the test so, that os.chdir() is not necessary.
      > so the tests are running in jython 2.2 (CVS) until 6 FAILURES!
      > (jython needs a right version of valueForKey().)
      > i think the failures are uncritical.
      > are my patches interesting you?
      >
      > here my failures:
      > FAIL Cheetah.Tests.CheetahWrapper.FlatRecurseCollision.testCompile ()
      > ----------------------------------------------------------------------
      > Traceback (most recent call last):
      > File "/home/matr/ewi/ewi/dev/pylib/Cheetah/Tests/CheetahWrapper.py", line
      > 452, in testCompile self.goExpectError("cheetah compile -R --flat")
      > File "/home/matr/ewi/ewi/dev/pylib/Cheetah/Tests/CheetahWrapper.py", line
      > 216, in goExpectError self.failUnlessEqual(signal, 0, msg) # Signal must be
      > 0.
      > File "/home/matr/ewi/ewi/dev/pylib/Cheetah/Tests/unittest_local_copy.py",
      > line 404, in failUnlessEqual raise self.failureException, (msg or '%s !=
      > %s' % (first, second)) AssertionError: subcommand killed by signal 1:
      > cheetah compile -R --flat
      >
      > **********************************************************************
      > FAIL Cheetah.Tests.CheetahWrapper.FlatRecurseCollision.testFill ()
      > ----------------------------------------------------------------------
      > Traceback (most recent call last):
      > File "/home/matr/ewi/ewi/dev/pylib/Cheetah/Tests/CheetahWrapper.py", line
      > 455, in testFill self.goExpectError("cheetah fill -R --flat")
      > File "/home/matr/ewi/ewi/dev/pylib/Cheetah/Tests/CheetahWrapper.py", line
      > 216, in goExpectError self.failUnlessEqual(signal, 0, msg) # Signal must be
      > 0.
      > File "/home/matr/ewi/ewi/dev/pylib/Cheetah/Tests/unittest_local_copy.py",
      > line 404, in failUnlessEqual raise self.failureException, (msg or '%s !=
      > %s' % (first, second)) AssertionError: subcommand killed by signal 1:
      > cheetah fill -R --flat
      >
      > **********************************************************************
      > FAIL Cheetah.Tests.CheetahWrapper.FlatRecurseCollision.testText ()
      > ----------------------------------------------------------------------
      > Traceback (most recent call last):
      > File "/home/matr/ewi/ewi/dev/pylib/Cheetah/Tests/CheetahWrapper.py", line
      > 458, in testText self.goExpectError("cheetah fill -R --flat")
      > File "/home/matr/ewi/ewi/dev/pylib/Cheetah/Tests/CheetahWrapper.py", line
      > 216, in goExpectError self.failUnlessEqual(signal, 0, msg) # Signal must be
      > 0.
      > File "/home/matr/ewi/ewi/dev/pylib/Cheetah/Tests/unittest_local_copy.py",
      > line 404, in failUnlessEqual raise self.failureException, (msg or '%s !=
      > %s' % (first, second)) AssertionError: subcommand killed by signal 1:
      > cheetah fill -R --flat
      >
      > **********************************************************************
      > FAIL Cheetah.Tests.CheetahWrapper.IdirFlatRecurseCollision.testCompile ()
      > ----------------------------------------------------------------------
      > Traceback (most recent call last):
      > File "/home/matr/ewi/ewi/dev/pylib/Cheetah/Tests/CheetahWrapper.py", line
      > 503, in testCompile self.goExpectError("cheetah compile -R --flat --idir "
      > + self.scratchDir + '/' + "SRC") File
      > "/home/matr/ewi/ewi/dev/pylib/Cheetah/Tests/CheetahWrapper.py", line 216,
      > in goExpectError self.failUnlessEqual(signal, 0, msg) # Signal must be 0.
      > File "/home/matr/ewi/ewi/dev/pylib/Cheetah/Tests/unittest_local_copy.py",
      > line 404, in failUnlessEqual raise self.failureException, (msg or '%s !=
      > %s' % (first, second)) AssertionError: subcommand killed by signal 1:
      > cheetah compile -R --flat --idir /tmp/tmp67/SRC
      >
      > **********************************************************************
      > FAIL Cheetah.Tests.CheetahWrapper.IdirFlatRecurseCollision.testFill ()
      > ----------------------------------------------------------------------
      > Traceback (most recent call last):
      > File "/home/matr/ewi/ewi/dev/pylib/Cheetah/Tests/CheetahWrapper.py", line
      > 506, in testFill self.goExpectError("cheetah fill -R --flat --idir " +
      > self.scratchDir + '/' + "SRC") File
      > "/home/matr/ewi/ewi/dev/pylib/Cheetah/Tests/CheetahWrapper.py", line 216,
      > in goExpectError self.failUnlessEqual(signal, 0, msg) # Signal must be 0.
      > File "/home/matr/ewi/ewi/dev/pylib/Cheetah/Tests/unittest_local_copy.py",
      > line 404, in failUnlessEqual raise self.failureException, (msg or '%s !=
      > %s' % (first, second)) AssertionError: subcommand killed by signal 1:
      > cheetah fill -R --flat --idir /tmp/tmp68/SRC
      >
      > **********************************************************************
      > FAIL Cheetah.Tests.CheetahWrapper.IdirFlatRecurseCollision.testText ()
      > ----------------------------------------------------------------------
      > Traceback (most recent call last):
      > File "/home/matr/ewi/ewi/dev/pylib/Cheetah/Tests/CheetahWrapper.py", line
      > 509, in testText self.goExpectError("cheetah fill -R --flat --idir " +
      > self.scratchDir + '/' + "SRC --oext " + self.scratchDir + '/' + "txt") File
      > "/home/matr/ewi/ewi/dev/pylib/Cheetah/Tests/CheetahWrapper.py", line 216,
      > in goExpectError self.failUnlessEqual(signal, 0, msg) # Signal must be 0.
      > File "/home/matr/ewi/ewi/dev/pylib/Cheetah/Tests/unittest_local_copy.py",
      > line 404, in failUnlessEqual raise self.failureException, (msg or '%s !=
      > %s' % (first, second)) AssertionError: subcommand killed by signal 1:
      > cheetah fill -R --flat --idir /tmp/tmp69/SRC --oext /tmp/tmp69/txt
      >
      > i mean the error in jython comes from the following codesnippet:
      > exit, output = commands.getstatusoutput(cmd)
      > status, signal = divmod(exit, 256)
      > i don't no why?
      >
      > regards marco
      >
      > On Friday 20 February 2004 21:33, Mike Orr wrote:
      > > On Fri, Feb 20, 2004 at 03:29:57PM +0100, marco wrote:
      > > > -----BEGIN PGP SIGNED MESSAGE-----
      > > > Hash: SHA1
      > > >
      > > > hi folks,
      > > >
      > > > if i remove the lib _namemapper.so with python2.1 i get the following
      > > > errors on cheetah test:
      > > > ERROR Cheetah.Tests.SyntaxAndOutput.NameMapperDict.test1 ()
      > > > -
      > > > ----------------------------------------------------------------------
      > > > Traceback (most recent call last):
      > > > File
      > > > "/home/marco/src/python/cheetah/lib/python/Cheetah/Tests/SyntaxAndOutpu
      > > >t. py", line 815, in test1 self.verify("$update", "Yabba dabba doo!")
      > > > File
      > > > "/home/marco/src/python/cheetah/lib/python/Cheetah/Tests/SyntaxAndOutpu
      > > >t. py", line 147, in verify self._verify(output)
      > > > File
      > > > "/home/marco/src/python/cheetah/lib/python/Cheetah/Tests/SyntaxAndOutpu
      > > >t. py", line 163, in _verify output = str(templateObj)
      > > > File "<string>", line 28, in respond
      > > > File
      > > > "/home/marco/src/python/cheetah/lib/python/Cheetah/NameMapper.py", line
      > > > 255, in valueFromSearchList executeCallables=executeCallables,
      > > > passNamespace=True)
      > > > File
      > > > "/home/marco/src/python/cheetah/lib/python/Cheetah/NameMapper.py", line
      > > > 234, in _valueForName binding = binding()
      > > > TypeError: function takes at least one argument
      > >
      > > Oh dear, that's the dict-method bug. Cheetah adds a hidden dictionary to
      > > the start of the searchList, and Python added an .update method to dicts
      > > fairly recently. So the wrong object is found for $update, and that
      > > object (the dict method) requires an argument.
      > >
      > > NameMapper is in flux to fix this bug. A partial update was done to
      > > NameMapper.py but wasn't ported to _namemapper.c, and the project was
      > > never completed. (It's still on the TODO list for 1.0.) Cheetah prefers
      > > the C namemapper but falls back to the Python one if it's not available.
      > >
      > > That test is disabled in the CVS version of Cheetah. The CVS version
      > > also has several other fixes, so I guess it's high time we make another
      > > release.



      -------------------------------------------------------
      SF.Net is sponsored by: Speed Start Your Linux Apps Now.
      Build and deploy apps & Web services for Linux with
      a free DVD software kit from IBM. Click Now!
      http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
      _______________________________________________
      Cheetahtemplate-discuss mailing list
      Cheetahtemplate-discuss@...
      https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
    Your message has been successfully submitted and would be delivered to recipients shortly.