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 #1333 (closed defect: worksforme)

Opened 10 years ago

Last modified 10 years ago

deepcopy error, caused by PlainText

Reported by: dalke Owned by:
Priority: normal Milestone: 1.0.2
Component: unassigned Version: 1.0
Severity: normal Keywords:
Cc:

Description

I tried to use the schema

class UserSchema(validators.Schema):
    user_name = validators.PlainText()

as the validator for a form. Doing so gave the exception

[josiah:~/rachel/pachy3] dalke% ./start-pachy3.py
Traceback (most recent call last):
  File "./start-pachy3.py", line 23, in <module>
    from pachy3.controllers import Root
  File "/Users/dalke/rachel/pachy3/pachy3/controllers.py", line 72, in <module>
    account_form = UserAccountForm()
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/TurboGears-1.1a0-py2.5.egg/turbogears/widgets/meta.py", line 168, in widget_init
    validator = generate_schema(self.validator, widgets)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/TurboGears-1.1a0-py2.5.egg/turbogears/widgets/meta.py", line 247, in generate_schema
    schema = copy_schema(schema)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/TurboGears-1.1a0-py2.5.egg/turbogears/widgets/meta.py", line 192, in copy_schema
    return copy.deepcopy(schema)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/copy.py", line 189, in deepcopy
    y = _reconstruct(x, rv, 1, memo)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/copy.py", line 337, in _reconstruct
    state = deepcopy(state, memo)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/copy.py", line 162, in deepcopy
    y = copier(x, memo)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/copy.py", line 254, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/copy.py", line 162, in deepcopy
    y = copier(x, memo)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/copy.py", line 254, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/copy.py", line 189, in deepcopy
    y = _reconstruct(x, rv, 1, memo)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/copy.py", line 337, in _reconstruct
    state = deepcopy(state, memo)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/copy.py", line 162, in deepcopy
    y = copier(x, memo)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/copy.py", line 254, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/copy.py", line 173, in deepcopy
    y = copier(memo)
TypeError: cannot deepcopy this pattern object

Removing the PlainText? with my own validator (which does not have a class variable containing the regular expression pattern) makes the problem go away.

Attachments

meta.diff Download (989 bytes) - added by alberto 10 years ago.

Change History

comment:1 Changed 10 years ago by alberto

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

I tried to reproduce this problem with no success. Comitted the unit test I used at [2840].

I've made a patch that might solve the issue but I'm hesitant to appply it without a failing test. I'll attach it for the record.

I'll close this as "worksforme", if you manage to reproduce the problem please give more info on how to reproduce it.

Thanks, Alberto

Changed 10 years ago by alberto

comment:2 Changed 10 years ago by alberto

Applied at [2954]

Note: See TracTickets for help on using tickets.