Skip to content

Commit

Permalink
Removed time_to_live setting from portlet
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosfromero committed Oct 20, 2013
1 parent 0cff4d6 commit ef88534
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
1 change: 0 additions & 1 deletion src/collective/weather/portlets/configure.zcml
Expand Up @@ -13,7 +13,6 @@
edit_permission="cmf.ManagePortal"
renderer=".weather.Renderer"
addview=".weather.AddForm"
editview=".weather.EditForm"
/>

</configure>
26 changes: 4 additions & 22 deletions src/collective/weather/portlets/weather.py
Expand Up @@ -3,33 +3,24 @@
from collective.weather import _
from collective.weather.interfaces import IWeatherUtility
from plone.app.portlets.portlets import base
from plone.app.portlets.browser.formhelper import NullAddForm
from plone.portlets.interfaces import IPortletDataProvider
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from zope import schema
from zope.component import getUtility
from zope.formlib import form
from zope.interface import implements


class IWeatherPortlet(IPortletDataProvider):
""" A weather portlet
"""

time_to_live = schema.Float(
title=_(u"Time to live"),
description=_("After the specified minutes, the portlet will refresh its data"),
required=True)


class Assignment(base.Assignment):
""" Portlet assignment.
"""

implements(IWeatherPortlet)

def __init__(self, time_to_live=30):
self.time_to_live = time_to_live

@property
def title(self):
"""This property is used to give the title of the portlet in the
Expand All @@ -49,18 +40,9 @@ def update(self):
self.weather_info = weather_utility.get_weather_info()


class AddForm(base.AddForm):
class AddForm(NullAddForm):
"""Portlet add form.
"""

form_fields = form.Fields(IWeatherPortlet)

def create(self, data):
return Assignment(**data)


class EditForm(base.EditForm):
"""Portlet edit form.
"""

form_fields = form.Fields(IWeatherPortlet)
def create(self):
return Assignment()

0 comments on commit ef88534

Please sign in to comment.