Skip to content

Commit

Permalink
Fix django-cms#4135 - Cast watch_models to list
Browse files Browse the repository at this point in the history
  • Loading branch information
yakky committed Jun 7, 2015
1 parent dc80fb2 commit e02cd73
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cms/test_utils/project/placeholderapp/cms_toolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

@toolbar_pool.register
class Example1Toolbar(CMSToolbar):
watch_models = [Example1, CharPksExample]
watch_models = (Example1, CharPksExample)

def populate(self):
admin_menu = self.toolbar.get_or_create_menu(ADMIN_MENU_IDENTIFIER)
Expand Down
4 changes: 4 additions & 0 deletions cms/tests/toolbar_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,7 @@ def test_settings(self):
response = self.client.get("/en/?%s" % get_cms_setting('CMS_TOOLBAR_URL__EDIT_ON'))
self.assertEqual(response.status_code, 200)
toolbar_pool.toolbars = toolbars

def test_watch_models(self):
toolbar_pool.discover_toolbars()
self.assertEqual(type(toolbar_pool.get_watch_models()), list)
2 changes: 1 addition & 1 deletion cms/toolbar_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def get_toolbars(self):
return self.toolbars

def get_watch_models(self):
return sum((getattr(tb, 'watch_models', [])
return sum((list(getattr(tb, 'watch_models', []))
for tb in self.toolbars.values()), [])


Expand Down

0 comments on commit e02cd73

Please sign in to comment.