Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError when using RegexValidator #913

Closed
Bouke opened this issue Jun 5, 2013 · 0 comments
Closed

TypeError when using RegexValidator #913

Bouke opened this issue Jun 5, 2013 · 0 comments
Labels

Comments

@Bouke
Copy link
Contributor

Bouke commented Jun 5, 2013

I have a RegexValidator defined as:

code_validator = RegexValidator('[A-Z]{2}-\d{5}', code='incorrect')

and trying to use it like:

class MyField(serializers.RelatedField):
    default_validators = [code_validator]

However, this fails with the stack trace below.

Traceback:
File "/django/core/handlers/base.py" in get_response
  140.                     response = response.render()
File "/django/template/response.py" in render
  105.             self.content = self.rendered_content
File "/rest_framework/response.py" in rendered_content
  59.         ret = renderer.render(self.data, media_type, context)
File "/rest_framework/renderers.py" in render
  524.         post_form = self._get_form(view, 'POST', request)
File "/rest_framework/renderers.py" in _get_form
  417.             return self.get_form(view, method, request)
File "/rest_framework/renderers.py" in get_form
  449.         serializer = view.get_serializer(instance=obj)
File "/rest_framework/generics.py" in get_serializer
  78.                                 many=many, partial=partial, context=context)
File "/rest_framework/serializers.py" in __init__
  159.         self.fields = self.get_fields()
File "/rest_framework/serializers.py" in get_fields
  191.         base_fields = copy.deepcopy(self.base_fields)
File "/python2.7/copy.py" in deepcopy
  174.                 y = copier(memo)
File "/django/utils/datastructures.py" in __deepcopy__
  138.                                for key, value in self.items()])
File "/python2.7/copy.py" in deepcopy
  190.                 y = _reconstruct(x, rv, 1, memo)
File "/python2.7/copy.py" in _reconstruct
  334.             state = deepcopy(state, memo)
File "/python2.7/copy.py" in deepcopy
  163.         y = copier(x, memo)
File "/python2.7/copy.py" in _deepcopy_dict
  257.         y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/python2.7/copy.py" in deepcopy
  163.         y = copier(x, memo)
File "/python2.7/copy.py" in _deepcopy_list
  230.         y.append(deepcopy(a, memo))
File "/python2.7/copy.py" in deepcopy
  190.                 y = _reconstruct(x, rv, 1, memo)
File "/python2.7/copy.py" in _reconstruct
  334.             state = deepcopy(state, memo)
File "/python2.7/copy.py" in deepcopy
  163.         y = copier(x, memo)
File "/python2.7/copy.py" in _deepcopy_dict
  257.         y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/python2.7/copy.py" in deepcopy
  174.                 y = copier(memo)

Exception Type: TypeError at /.../
Exception Value: cannot deepcopy this pattern object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant