Skip to content

Commit 93fd065

Browse files
committed
Add docstrings
1 parent 81c3493 commit 93fd065

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/collective/cover/tiles/calendar.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def _setup(self):
7373
self._set_first_weekday()
7474

7575
def _set_first_weekday(self):
76+
"""Set calendar library first weekday for calendar."""
7677
try: # Plone 5.x
7778
first_weekday = api.portal.get_registry_record('plone.first_weekday')
7879
except InvalidParameterError:
@@ -89,6 +90,7 @@ def accepted_ct(self):
8990

9091
@ram.cache(_catalog_counter_cachekey)
9192
def getEvents(self):
93+
"""Return all events in the selected month."""
9294
catalog = api.portal.get_tool('portal_catalog')
9395
_, last_day = calendar.monthrange(self.year, self.month)
9496
start = DateTime(self.year, self.month, 1)
@@ -105,6 +107,7 @@ def getEvents(self):
105107
return events
106108

107109
def getEventsForCalendar(self):
110+
"""Return the month data filled with events."""
108111
events = self.getEvents()
109112
monthcalendar = calendar.monthcalendar(self.year, self.month)
110113
weeks = []
@@ -133,6 +136,7 @@ def getEventsForCalendar(self):
133136
return weeks
134137

135138
def getEventString(self, event):
139+
"""Get event string to make event list hint on mouse over."""
136140
start = event['start'] and ':'.join(event['start'].split(':')[:2]) or ''
137141
end = event['end'] and ':'.join(event['end'].split(':')[:2]) or ''
138142
title = safe_unicode(event['title']) or u'event'
@@ -173,13 +177,15 @@ def getYearAndMonthToDisplay(self):
173177
return year, month
174178

175179
def getPreviousMonth(self, year, month):
180+
"""Get previous month."""
176181
if month == 0 or month == 1:
177182
month, year = 12, year - 1
178183
else:
179184
month -= 1
180185
return (year, month)
181186

182187
def getNextMonth(self, year, month):
188+
"""Get next month."""
183189
if month == 12:
184190
month, year = 1, year + 1
185191
else:
@@ -204,17 +210,20 @@ def isToday(self, day):
204210
self.now[2] == day and self.now[1] == self.month and self.now[0] == self.year)
205211

206212
def getReviewStateString(self):
213+
"""Get Review State String."""
207214
states = ['published']
208215
return ''.join(map(lambda x: 'review_state={0}&'.format(self.url_quote_plus(x)), states))
209216

210217
@ram.cache(_catalog_counter_cachekey)
211218
def getEventTypes(self):
219+
"""Get a list of events portal types."""
212220
catalog = api.portal.get_tool('portal_catalog')
213221
query = dict(object_provides=EVENT_INTERFACES)
214222
types = set([b.portal_type for b in catalog(**query)])
215223
return ''.join(map(lambda x: 'Type={0}&'.format(self.url_quote_plus(x)), types))
216224

217225
def getQueryString(self):
226+
"""Get current url get parameters."""
218227
request = self.request
219228
query_string = request.get('orig_query',
220229
request.get('QUERY_STRING', None))

0 commit comments

Comments
 (0)