Opened 18 years ago

Closed 13 years ago

#2115 closed defect (fixed)

'tuple' object has no attribute 'startswith'

Reported by: pepe@… Owned by: Adrian Holovaty
Component: contrib.admin Version: dev
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In the last development version,
Inthe admin interface
in ImageField, when you trie to modify an file(upload another) send the next error(sorry my english),

Traceback (most recent call last):
File "/usr/lib64/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/handlers/base.py" in get_response

  1. response = callback(request, *callback_args, callback_kwargs)

File "/usr/lib64/python2.4/site-packages/Django-0.95-py2.4.egg/django/contrib/admin/views/decorators.py" in _checklogin

  1. return view_func(request, *args, kwargs)

File "/usr/lib64/python2.4/site-packages/Django-0.95-py2.4.egg/django/views/decorators/cache.py" in _wrapped_view_func

  1. response = view_func(request, *args, kwargs)

File "/usr/lib64/python2.4/site-packages/Django-0.95-py2.4.egg/django/contrib/admin/views/main.py" in change_stage

  1. errors = manipulator.get_validation_errors(new_data)

File "/usr/lib64/python2.4/site-packages/Django-0.95-py2.4.egg/django/forms/init.py" in get_validation_errors

  1. errors.update(field.get_validation_errors(new_data))

File "/usr/lib64/python2.4/site-packages/Django-0.95-py2.4.egg/django/forms/init.py" in get_validation_errors

  1. self.run_validator(new_data, validator)

File "/usr/lib64/python2.4/site-packages/Django-0.95-py2.4.egg/django/forms/init.py" in run_validator

  1. validator(new_data.get(self.field_name, ), new_data)

File "/usr/lib64/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/models/fields/init.py" in isWithinMediaRoot

  1. if not f.startswith(os.path.normpath(settings.MEDIA_ROOT)):

File "/usr/lib64/python2.4/posixpath.py" in normpath

  1. initial_slashes = path.startswith('/')

AttributeError at /admin/cotix/producto/1/
'tuple' object has no attribute 'startswith'

Change History (4)

comment:1 by Malcolm Tredinnick, 18 years ago

Resolution: invalid
Status: newclosed

Have a look in your settings.py file and check that the MEDIA_ROOT line does not end with a comma. It looks like you are passing in a one-tuple, rather than a string, based on the error message.

If that is not the case, please reopen this and paste the MEDIA_ROOT value from your settings file. But at the moment, it looks like a configuration problem.

comment:3 by Karen Tracey, 15 years ago

comment:4 by m.vilacides@…, 13 years ago

Easy pickings: unset
Resolution: invalid
Status: closedreopened

I have the same problem. My media_root is MEDIA_ROOT = path.join(BASEDIR, 'media/').

comment:5 by anonymous, 13 years ago

Resolution: fixed
Status: reopenedclosed

The problem was that I had two different versions of tagging package, and I was ussing the older one. Now I've updated my tagging package version to 0.3.1 and it works.

Note: See TracTickets for help on using tickets.
Back to Top