[CMF-checkins] CVS: CMF/CMFCalendar - CalendarTool.py:1.8.10.3
Event.py:1.13.4.2 __init__.py:1.4.28.1 version.txt:1.3.20.6
Sidnei da Silva
sidnei at awkly.org
Thu Apr 22 13:48:13 EDT 2004
Update of /cvs-repository/CMF/CMFCalendar
In directory cvs.zope.org:/tmp/cvs-serv30596/CMFCalendar
Modified Files:
Tag: CMF-1_4-branch
CalendarTool.py Event.py __init__.py version.txt
Log Message:
Fix version.txt to right version. Run reindent.py for removing extra tabs and whitespaces
=== CMF/CMFCalendar/CalendarTool.py 1.8.10.2 => 1.8.10.3 ===
--- CMF/CMFCalendar/CalendarTool.py:1.8.10.2 Sun Apr 18 15:23:55 2004
+++ CMF/CMFCalendar/CalendarTool.py Thu Apr 22 13:47:42 2004
@@ -49,7 +49,7 @@
security.declareProtected( ManagePortal, 'manage_configure' )
manage_configure = PageTemplateFile('www/configureCalendarTool', globals(),
__name__='manage_configure')
-
+
def __init__(self):
self.calendar_types = ['Event']
self.use_session = ""
@@ -61,7 +61,7 @@
self.use_session = use_session
if hasattr(self.REQUEST, 'RESPONSE'):
self.REQUEST.RESPONSE.redirect('manage_configure')
-
+
security.declarePublic('getCalendarTypes')
def getCalendarTypes(self):
""" Returns a list of type that will show in the calendar """
@@ -74,9 +74,9 @@
security.declarePublic('getDays')
def getDays(self):
- """ Returns a list of days with the correct start day first """
+ """ Returns a list of days with the correct start day first """
return calendar.weekheader(2).split()
-
+
security.declarePublic('getWeeksList')
def getWeeksList(self, month='1', year='2002'):
"""Creates a series of weeks, each of which contains an integer day number.
@@ -89,7 +89,7 @@
# [21, 22, 23, 24, 25, 26, 27],
# [28, 29, 30, 31, 0, 0, 0]]
daysByWeek=calendar.monthcalendar(year, month)
-
+
return daysByWeek
security.declarePublic('getEventsForCalendar')
@@ -107,9 +107,9 @@
# [28, 29, 30, 31, 0, 0, 0]]
daysByWeek=calendar.monthcalendar(year, month)
weeks=[]
-
+
events=self.catalog_getevents(year, month)
-
+
for week in daysByWeek:
days=[]
for day in week:
@@ -117,11 +117,11 @@
days.append(events[day])
else:
days.append({'day': day, 'event': 0, 'eventslist':[]})
-
+
weeks.append(days)
-
+
return weeks
-
+
security.declarePublic('catalog_getevents')
def catalog_getevents(self, year, month):
""" given a year and month return a list of days that have events """
@@ -129,17 +129,17 @@
last_day=calendar.monthrange(year, month)[1]
## This line was cropping the last day of the month out of the
## calendar when doing the query
- ## last_date=DateTime(str(month)+'/'+str(last_day)+'/'+str(year))
- last_date=first_date + last_day
-
- query=self.portal_catalog(portal_type=self.calendar_types,
- review_state='published',
+ ## last_date=DateTime(str(month)+'/'+str(last_day)+'/'+str(year))
+ last_date=first_date + last_day
+
+ query=self.portal_catalog(portal_type=self.calendar_types,
+ review_state='published',
start={'query': last_date,
'range': 'max'},
end={'query': first_date,
'range': 'min'},
sort_on='start')
-
+
# compile a list of the days that have events
eventDays={}
for daynumber in range(1, 32): # 1 to 31
@@ -192,22 +192,22 @@
A) Start on this day OR
B) End on this day OR
C) Start before this day AND end after this day"""
-
+
catalog = self.portal_catalog
-
+
first_date, last_date = self.getBeginAndEndTimes(thisDay.day(), thisDay.month(), thisDay.year())
#first_date=DateTime(thisDay.Date()+" 00:00:00")
#last_date=DateTime(thisDay.Date()+" 23:59:59")
# Get all events that Start on this day
query=self.portal_catalog(portal_type=self.calendar_types,
- review_state='published',
+ review_state='published',
start={'query': (first_date,last_date),
'range': 'min:max'})
-
+
# Get all events that End on this day
query+=self.portal_catalog(portal_type=self.calendar_types,
- review_state='published',
+ review_state='published',
end={'query': (first_date,last_date),
'range': 'min:max'})
@@ -227,66 +227,66 @@
if not rid in rids:
results.append(item)
rids.append(rid)
-
+
def sort_function(x,y):
z = cmp(x.start,y.start)
- if not z:
+ if not z:
return cmp(x.end,y.end)
return z
-
+
# Sort by start date
results.sort(sort_function)
-
+
return results
-
-
+
+
security.declarePublic('getPreviousMonth')
def getPreviousMonth(self, month, year):
# given any particular year and month, this method will return a datetime object
# for one month prior
-
+
try: month=int(month)
except: raise "Calendar Type Error", month
try: year=int(year)
except: raise "Calendar Type Error", year
-
+
if month==0 or month==1:
month, year = 12, year - 1
else:
month-=1
-
- return DateTime(str(month) + '/1/' + str(year))
-
+
+ return DateTime(str(month) + '/1/' + str(year))
+
security.declarePublic('getNextMonth')
def getNextMonth(self, month, year):
# given any particular year and month, this method will return a datetime object
# for one month after
-
+
try: month=int(month)
except: raise "Calendar Type Error", month
try: year=int(year)
except: raise "Calendar Type Error", year
-
+
if month==12:
month, year = 1, year + 1
else:
month+=1
-
+
return DateTime(str(month) + '/1/' + str(year))
security.declarePublic('getBeginAndEndTimes')
def getBeginAndEndTimes(self, day, month, year):
# Given any day, month and year this method returns 2 DateTime objects
# That represent the exact start and the exact end of that particular day.
-
+
day=str(day)
month=str(month)
year=str(year)
-
+
begin=DateTime(month+'/'+day+'/'+year+' 12:00:00AM')
end=DateTime(month+'/'+day+'/'+year+' 11:59:59PM')
-
- return (begin, end)
-
-
+
+ return (begin, end)
+
+
InitializeClass(CalendarTool)
=== CMF/CMFCalendar/Event.py 1.13.4.1 => 1.13.4.2 ===
--- CMF/CMFCalendar/Event.py:1.13.4.1 Fri May 9 17:31:37 2003
+++ CMF/CMFCalendar/Event.py Thu Apr 22 13:47:42 2004
@@ -57,9 +57,9 @@
, id
, title=''
, description=''
- , effective_date = None
- , expiration_date = None
- , start_date = None
+ , effective_date = None
+ , expiration_date = None
+ , start_date = None
, end_date = None
, location=''
, contact_name=''
@@ -109,7 +109,7 @@
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(View)
-
+
__implements__ = ( PortalContent.__implements__
, DefaultDublinCoreImpl.__implements__
)
@@ -118,8 +118,8 @@
, id
, title=''
, description=''
- , effective_date = None
- , expiration_date = None
+ , effective_date = None
+ , expiration_date = None
, start_date = None
, end_date = None
, location=''
@@ -140,7 +140,7 @@
start_date = DateTime()
if end_date is None:
end_date = start_date
-
+
if end_date < start_date:
end_date = start_date
@@ -159,7 +159,7 @@
if attrib is not None:
attrib = DateTime( attrib )
return attrib
-
+
security.declarePublic('getEndStrings')
def getEndStrings(self):
"""
@@ -195,8 +195,8 @@
):
"""\
"""
-
- if title is not None:
+
+ if title is not None:
self.setTitle(title)
if description is not None:
self.setDescription(description)
@@ -223,12 +223,12 @@
, stopAMPM
)
end_date = DateTime( exdate )
-
+
if start_date and end_date:
if end_date < start_date:
end_date = start_date
-
+
self.setStartDate( start_date )
self.setEndDate( end_date )
@@ -243,8 +243,8 @@
if event_url is not None:
self.event_url = event_url
self.reindexObject()
- edit = WorkflowAction(edit)
-
+ edit = WorkflowAction(edit)
+
security.declarePublic('buildTimes')
def buildTimes(self):
result = []
@@ -252,7 +252,7 @@
for min in (00, 30):
result.append('%02d:%02d' % (hour, min))
return result
-
+
security.declarePublic('buildDays')
def buildDays(self):
result = []
@@ -266,7 +266,7 @@
for month in range (1, 13):
result.append(str('%d' % (month)))
return result
-
+
security.declarePublic('buildYears')
def buildYears(self):
result = []
@@ -282,7 +282,7 @@
Setting the event start date, when the event is scheduled to begin.
"""
self.start_date = self._datify(start)
-
+
security.declareProtected(EventPermissions.ChangeEvents, 'setEndDate')
def setEndDate(self, end):
"""
@@ -304,21 +304,21 @@
Return our stop time as a string.
"""
date = getattr( self, 'end_date', None )
- return date is None and self.start() or date
+ return date is None and self.start() or date
security.declarePublic('getStartTimeString')
def getStartTimeString( self ):
"""
Return our start time as a string.
"""
- return self.start().AMPMMinutes()
+ return self.start().AMPMMinutes()
security.declarePublic('getStopTimeString')
def getStopTimeString( self ):
"""
Return our stop time as a string.
"""
- return self.end().AMPMMinutes()
+ return self.end().AMPMMinutes()
security.declarePrivate('handleText')
def handleText(self, text, format=None):
@@ -357,7 +357,7 @@
language=headers['Language'],
rights=headers['Rights'],
)
-
+
security.declarePublic( 'getMetadataHeaders' )
def getMetadataHeaders(self):
"""Return RFC-822-style header spec."""
@@ -398,7 +398,7 @@
, contact_phone=headers['ContactPhone']
, event_url=headers['EventURL']
)
-
+
except ResourceLockedError, msg:
get_transaction().abort()
RESPONSE.setStatus(423)
=== CMF/CMFCalendar/__init__.py 1.4 => 1.4.28.1 ===
--- CMF/CMFCalendar/__init__.py:1.4 Fri May 10 11:45:47 2002
+++ CMF/CMFCalendar/__init__.py Thu Apr 22 13:47:42 2004
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
from Products.CMFDefault import Portal
import Event
@@ -41,13 +41,13 @@
utils.ToolInit('CMFCalendar Tool', tools=tools,
product_name='CMFCalendar', icon='tool.gif',
).initialize( context )
-
+
utils.initializeBasesPhase2( z_bases, context )
context.registerHelpTitle('CMF Calendar Help')
context.registerHelp(directory='help')
utils.ContentInit( 'CMF Event'
, content_types = contentClasses
- , permission = CMFCorePermissions.AddPortalContent
+ , permission = CMFCorePermissions.AddPortalContent
, extra_constructors = contentConstructors
, fti = Event.factory_type_information
- ).initialize( context )
+ ).initialize( context )
=== CMF/CMFCalendar/version.txt 1.3.20.5 => 1.3.20.6 ===
--- CMF/CMFCalendar/version.txt:1.3.20.5 Thu Feb 5 01:06:34 2004
+++ CMF/CMFCalendar/version.txt Thu Apr 22 13:47:42 2004
@@ -1 +1,2 @@
-CMF-1.4.3-rc1
+CMF-1.4.3
+
More information about the CMF-checkins
mailing list