Adding inherit plugin throws an exception #800

Closed
mitar opened this Issue May 20, 2011 · 8 comments

4 participants

@mitar

When I try to add an inherit plugin in master version of django-cms I get this exception:

Exception Value: 'NoneType' object has no attribute 'site'
Exception Location: /srv/orange-cms/modules/cms/plugins/inherit/cms_plugins.py in get_form, line 84

Environment:

Request Method: GET
Request URL: http://...:8080/admin/cmsplugin_blog/entry/1/edit-plugin/14/
Django Version: 1.2.4
Python Version: 2.6.6
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.admin',
'django.contrib.admindocs',
'cms',
'mptt',
'menus',
'south',
'appmedia',
'easy_thumbnails',
'filer',
'tagging',
'reversion',
'djangocms_utils',
'simple_translation',
'cmsplugin_blog',
'cms.plugins.link',
'cms.plugins.snippet',
'cms.plugins.inherit',
'cmsplugin_filer_file',
'cmsplugin_filer_folder',
'cmsplugin_filer_teaser',
'cmsplugin_filer_video',
'cmsplugin_filer_image',
'cmsplugin_markup']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.media.PlaceholderMediaMiddleware',
'django.middleware.transaction.TransactionMiddleware')

Traceback:
File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py" in get_response

  1. response = callback(request, callback_args, *callback_kwargs) File "/usr/lib/pymodules/python2.6/django/utils/decorators.py" in _wrapped_view
  2. response = view_func(request, args, *kwargs) File "/usr/lib/pymodules/python2.6/django/views/decorators/cache.py" in _wrapped_view_func
  3. response = view_func(request, args, *kwargs) File "/usr/lib/pymodules/python2.6/django/contrib/admin/sites.py" in inner
  4. return view(request, args, *kwargs) File "/srv/orange-cms/modules/cms/admin/placeholderadmin.py" in edit_plugin
  5. response = plugin_admin.add_view(request) File "/usr/lib/pymodules/python2.6/django/utils/decorators.py" in _wrapper
  6. return decorator(bound_func)(args, *kwargs) File "/usr/lib/pymodules/python2.6/django/utils/decorators.py" in _wrapped_view
  7. response = view_func(request, args, *kwargs) File "/usr/lib/pymodules/python2.6/django/utils/decorators.py" in bound_func
  8. return func(self, args2, *kwargs2) File "/usr/lib/pymodules/python2.6/django/db/transaction.py" in _commit_on_success
  9. res = func(args, *kw) File "/usr/lib/pymodules/python2.6/django/contrib/admin/options.py" in add_view
  10. ModelForm = self.get_form(request) File "/srv/orange-cms/modules/cms/plugins/inherit/cms_plugins.py" in get_form
  11. return FakeForm(Form, self.cms_plugin_instance.page.site or self.page.site)

Exception Type: AttributeError at /admin/cmsplugin_blog/entry/1/edit-plugin/14/
Exception Value: 'NoneType' object has no attribute 'site'

@ojii

can you also reproduce this bug in develop? or was it fixed in there already?

@mitar

Don't have a working develop installation currently around. ;-)

@mbrochh

@mitar: does this happen in cmsplugin_blog only or even on normal pages? I have just setup a cms develop installation (django 1.3) and adding inherit plugins does work there. Wasn't able to get the blog running due to the bloody staticfiles app.

@mitar

Aha. Yes. It happens only with the blog. Is this an example of "The inherit plugin is currently the only core-plugin which can not be used in non-cms placeholders."?

@ojii

The inherit plugin relies on being on a page (otherwise, how should it know what to inherit from?), and since blog entries are not hierarchical, it doesn't make sense there.

I do think though that we have to document and/or raise a better exception. (Preventing the use of the inherit plugin outside of page-placeholders is far beyond the 2.2 scope).

@mitar

It would be great if the plugin would not be displayed as possible on non-page placeholders. Because now if I enable it and some user tries it, bam, there is an exception. Not really a good user experience.

@fivethreeo fivethreeo added a commit that referenced this issue Jun 10, 2011
@fivethreeo fivethreeo test and fix for #800 d666a7d
@fivethreeo

Fix and test: #852

@fivethreeo fivethreeo added a commit that referenced this issue Jun 13, 2011
@fivethreeo fivethreeo test and fix for #800 c5e8258
@fivethreeo fivethreeo added a commit that referenced this issue Jun 13, 2011
@fivethreeo fivethreeo attempt at fixing #800 ec1ee5c
@fivethreeo fivethreeo added a commit that referenced this issue Jun 13, 2011
@fivethreeo fivethreeo proper fix for #800 29045f6
@ojii

fixed in 0c80929

@ojii ojii closed this Jun 14, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment