Skip to content

Commit

Permalink
Cleanup obsolete 'sections' related code
Browse files Browse the repository at this point in the history
avoinea committed Dec 13, 2012
1 parent eb675ad commit f3ba22a
Showing 6 changed files with 6 additions and 74 deletions.
2 changes: 2 additions & 0 deletions docs/HISTORY.txt
Original file line number Diff line number Diff line change
@@ -5,6 +5,8 @@ Changelog
----------------------
* Upgrade step: Within "Plone > Site setup > Add-ons" click on
upgrade button available for eea.app.visualization
* Change: Cleanup old 'sections' code
[avoinea]
* Feature: Added confirm dialog in order to prevent accidentally disable of
visualizations
[voineali refs #9572]
41 changes: 0 additions & 41 deletions eea/app/visualization/browser/app/view.py
Original file line number Diff line number Diff line change
@@ -94,47 +94,6 @@ def tabs(self):
tabs.extend(getattr(browser, 'tabs', []))
return tabs

@property
def sections(self):
""" Returns view sections
"""
views = self.accessor.views

sections = {}
for view in views:
name = view.get('name')
browser = queryMultiAdapter(
(self.context, self.request), name=name)
section = getattr(browser, 'section', 'Default')
section_id = section.lower().replace(' ', '-')
sections[section_id] = section
return sections

def section_views(self, section):
""" Returns views for a section
"""
views = self.accessor.views
myviews = []
for view in views:
name = view.get('name')
browser = queryMultiAdapter(
(self.context, self.request), name=name)
section_name = getattr(browser, 'section', 'Default')
if section_name.lower().replace(' ', '-') != section:
continue
myviews.append(name)
return myviews

def section(self, name):
""" Get section by name
"""
view = queryMultiAdapter((self.context, self.request), name=name)
if not view:
logger.warn('There is no %s view registered for %s',
name, self.context.absolute_url(1))
return ''
return view()

def __call__(self, **kwargs):
""" If daviz is not configured redirects to edit page.
"""
8 changes: 0 additions & 8 deletions eea/app/visualization/browser/configure.zcml
Original file line number Diff line number Diff line change
@@ -13,14 +13,6 @@
provides="zope.formlib.namedtemplate.INamedTemplate"
/>

<browser:page
for="eea.app.visualization.interfaces.IVisualizationEnabled"
name="exhibit"
template="zpt/daviz.pt"
class=".app.view.View"
permission="zope2.View"
/>

<browser:page
for="eea.app.visualization.interfaces.IVisualizationEnabled"
name="daviz-view.html"
22 changes: 0 additions & 22 deletions eea/app/visualization/browser/zpt/daviz.pt

This file was deleted.

1 change: 0 additions & 1 deletion eea/app/visualization/views/interfaces.py
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@ class IVisualizationView(Interface):
""" Access / update visualization view configuration
"""
label = TextLine(title=u'Label for visualization view')
section = TextLine(title=u"Section of this view, e.g. Exhibit, Google, etc")

class IViewDirective(Interface):
"""
6 changes: 4 additions & 2 deletions eea/app/visualization/views/view.py
Original file line number Diff line number Diff line change
@@ -9,8 +9,10 @@ class ViewForm(BrowserView):
see implementation in eea.exhibit.views.map.view.View.
"""
label = ''
section = 'Exhibit'
_data = {}

def __init__(self, context, request):
super(ViewForm, self).__init__(context, request)
self._data = {}

@property
def data(self):

0 comments on commit f3ba22a

Please sign in to comment.