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 #1495 (closed defect: fixed)

Opened 12 years ago

Last modified 12 years ago

ToscaWidgets: AttributeError: 'module' object has no attribute 'copy'

Reported by: renier Owned by: alberto
Priority: high Milestone: 1.0.4
Component: ToscaWidgets Version: 1.0.3
Severity: normal Keywords:


Hello, I get the following with TurboGears- and ToscaWidgets?-0.1a2dev_3417.

Traceback (most recent call last):

File "./start-mytg.py", line 5, in ?

from turbogears import config, update_config, start_server

File "/usr/lib/python2.4/site-packages/TurboGears-

turbogears/init.py", line 21, in ?

ext = entrypoint.load()

File "/usr/lib/python2.4/site-packages/setuptools-0.6c6-py2.4.egg/

pkg_resources.py", line 1912, in load

entry = import(self.module_name, globals(),globals(),


File "/usr/lib/python2.4/site-packages/ToscaWidgets-0.1a2dev_r3417-

py2.4.egg/toscawidgets/mods/tg.py", line 51, in ?

class Turbogears(HostFramework?):

File "/usr/lib/python2.4/site-packages/ToscaWidgets-0.1a2dev_r3417-

py2.4.egg/toscawidgets/mods/tg.py", line 62, in Turbogears


File "/usr/lib/python2.4/site-packages/ToscaWidgets-0.1a2dev_r3417-

py2.4.egg/toscawidgets/view.py", line 88, in load_all

self.load_engine(ep.name, engine_options, stdvars)

File "/usr/lib/python2.4/site-packages/ToscaWidgets-0.1a2dev_r3417-

py2.4.egg/toscawidgets/view.py", line 57, in load_engine

options = options.copy()

AttributeError?: 'module' object has no attribute 'copy' --

I investigated a little and found that "options" is turbogears.config, which is not a dict object, as the exceptions says, but has some functions which makes it resemble one (e.g. get, update). "copy" is, as you can see, one of the functions it does _not_ have.

I think the following patch fixes it, but need someone more knowledgeable to look at it.

--- view.py.orig 2007-09-08 00:32:01.000000000 -0400 +++ view.py 2007-09-08 00:34:19.000000000 -0400 @@ -54,12 +54,13 @@

raise EngineException?("No plugin available for engine

'%s'" % name)

options = options or self.options or {}

  • options = options.copy()

+ tmp_options = {}

# emulate Kid and Genshi's dotted-path notation lookup

  • options.setdefault('mako.directories', []).extend(sys.path)

+ tmp_options.setdefault('mako.directories', []).extend(sys.path)

# make sure mako produces utf-8 output so we can decode it

and use

# unicode internally

+ tmp_optionsmako.output_encoding? = 'utf-8' + options.update(tmp_options)

extra_vars_func = extra_vars_func or self.extra_vars_func

# Check for deprecated use.




view.py.diff Download (1.0 KB) - added by renier 12 years ago.
Patch embedded in description above is attached here

Change History

Changed 12 years ago by renier

Patch embedded in description above is attached here

comment:1 Changed 12 years ago by paj

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

comment:2 Changed 12 years ago by kskuhlman

Wouldn't simply adding a copy method to turbogears.config work?

def copy():

return config.configMap.copy()

comment:3 Changed 12 years ago by alberto

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

This should be fixed in latest TW trunk. Please reopen if it isn't.


Note: See TracTickets for help on using tickets.