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: coercing to Unicode: need string or buffer, NoneType found #25

Open
gerardtoko opened this issue Jun 25, 2013 · 4 comments
Open

Comments

@gerardtoko
Copy link

Hello,

I thank you for the plugin in django-cms.

I have installed the version 0.6.3. I was the problem for the indexation with the command django: rebuild_index

The problem come here : text += obj.get_meta_keywords() if hasattr(obj, 'get_meta_keywords') else u'' in search_indexes.py.

I replace this line by text += obj.get_meta_keywords() or u''
It's good after.

Thanks.

@mbaechtold
Copy link

I can confirm this:

$ django-admin.py update_index
Indexing 38 pages (Portuguese).
Traceback (most recent call last):
  File "/path/to/my/virtualenv/bin/django-admin.py", line 5, in <module>
    management.execute_from_command_line()
  File "/path/to/my/virtualenv/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/path/to/my/virtualenv/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/path/to/my/virtualenv/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/path/to/my/virtualenv/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/path/to/my/virtualenv/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 193, in handle
    return super(Command, self).handle(*apps, **options)
  File "/path/to/my/virtualenv/lib/python2.7/site-packages/django/core/management/base.py", line 304, in handle
    app_output = self.handle_app(app, **options)
  File "/path/to/my/virtualenv/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 229, in handle_app
    do_update(index, qs, start, end, total, self.verbosity)
  File "/path/to/my/virtualenv/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 109, in do_update
    index.backend.update(index, current_qs)
  File "/path/to/my/virtualenv/lib/python2.7/site-packages/haystack/backends/whoosh_backend.py", line 175, in update
    doc = index.full_prepare(obj)
  File "/path/to/my/virtualenv/lib/python2.7/site-packages/haystack/indexes.py", line 156, in full_prepare
    self.prepared_data = self.prepare(obj)
  File "/path/to/my/virtualenv/lib/python2.7/site-packages/cms_search/search_indexes.py", line 86, in prepare
    text += obj.get_meta_keywords() if hasattr(obj, 'get_meta_keywords') else u''
TypeError: coercing to Unicode: need string or buffer, NoneType found

@gerardtoko
Copy link
Author

Test with
text += obj.get_meta_keywords() or u''

@murdav
Copy link

murdav commented Jul 19, 2013

Hello,

The same for me:

python manage.py rebuild_index --settings=demo.settings.local
Are you sure you wish to continue? [y/N] y

Indexing 13 django.utils.functional.proxy object at 0x37fb110
TypeError: coercing to Unicode: need string or buffer, NoneType found

@che0
Copy link

che0 commented Jul 3, 2014

Had the same problem. Changing the line to text += obj.get_meta_keywords() if hasattr(obj, 'get_meta_keywords') else u'' fixed it for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants