Skip to content

Commit

Permalink
Merge 6d972eb into 54ee7f2
Browse files Browse the repository at this point in the history
  • Loading branch information
rodfersou committed Feb 16, 2017
2 parents 54ee7f2 + 6d972eb commit 4129a12
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGES.rst
Expand Up @@ -6,6 +6,9 @@ There's a frood who really knows where his towel is.
1.0b4 (unreleased)
^^^^^^^^^^^^^^^^^^

- Fix view when plone.app.contenttypes is installed (closes `#16`_).
[rodfersou]

- Remove dependency on five.grok (closes `#11`_).
[rodfersou]

Expand Down Expand Up @@ -92,3 +95,4 @@ There's a frood who really knows where his towel is.
.. _`#7`: https://github.com/simplesconsultoria/sc.blog/issues/7
.. _`#9`: https://github.com/simplesconsultoria/sc.blog/issues/9
.. _`#11`: https://github.com/simplesconsultoria/sc.blog/issues/11
.. _`#16`: https://github.com/simplesconsultoria/sc.blog/issues/16
25 changes: 13 additions & 12 deletions src/sc/blog/browser/blog.py
Expand Up @@ -3,13 +3,24 @@
from plone import api
from plone.app.layout.viewlets import ViewletBase
from Products.CMFCore.interfaces import ISiteRoot
from Products.Five.browser import BrowserView
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from sc.blog.config import BLOG_BLACKLISTED_TYPES
from sc.blog.content import IBlog

import pkg_resources

class View(BrowserView):

try:
pkg_resources.get_distribution('plone.app.contenttypes')
except pkg_resources.DistributionNotFound:
# Don`t have plone.app.contenttypes
from Products.Five.browser import BrowserView as ViewBase
else:
# Has plone.app.contenttypes
from plone.app.contenttypes.browser.folder import FolderView as ViewBase


class View(ViewBase):

"""Default view. Looks like a standard Folder Full View."""

Expand All @@ -31,16 +42,6 @@ def __call__(self):
return self.index()


class BlogSummaryView(View):

"""Looks like a standard Folder Summary View."""

index = ViewPageTemplateFile('templates/folder_summary_view.pt')

def __call__(self):
return self.index()


class BlogHeader(ViewletBase):

"""A viewlet to include a header in the container (Blog) and contained
Expand Down
4 changes: 3 additions & 1 deletion src/sc/blog/browser/configure.zcml
Expand Up @@ -9,14 +9,16 @@
for="..content.IBlog"
name="view"
class=".blog.View"
template="templates/folder_full_view.pt"
permission="zope2.View"
layer="..interfaces.IBlogLayer"
/>

<browser:page
for="..content.IBlog"
name="blog_summary_view"
class=".blog.BlogSummaryView"
class=".blog.View"
template="templates/folder_summary_view.pt"
permission="zope2.View"
layer="..interfaces.IBlogLayer"
/>
Expand Down

0 comments on commit 4129a12

Please sign in to comment.