jtoolkit-cvs Mailing List for jToolkit
Brought to you by:
davidfraser,
friedelwolff
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(15) |
Oct
(12) |
Nov
|
Dec
(4) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
|
Feb
(100) |
Mar
(27) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <dav...@us...> - 2004-03-10 07:39:43
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20928 Modified Files: chart.py Log Message: Can now handle empty datasets in most cases (there seem to be cases where it fails) Index: chart.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/chart.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** chart.py 10 Mar 2004 07:13:30 -0000 1.26 --- chart.py 10 Mar 2004 07:14:02 -0000 1.27 *************** *** 154,159 **** self.figure.get_current_axis().set_xlim([self.startVal, self.endVal]) ! #Draw a legend ! self.figure.get_current_axis().legend(self.legendlabels,2) NUM_TIME_LABELS = 10 --- 154,160 ---- self.figure.get_current_axis().set_xlim([self.startVal, self.endVal]) ! #Draw a legend, but only if there are any plots to draw ! if self.legendlabels: ! self.figure.get_current_axis().legend(self.legendlabels,2) NUM_TIME_LABELS = 10 *************** *** 169,174 **** def getdata(self): chartdata = self.charttable.gettablerows(self.filter) ! self.ydata = [[self.mapfromNone(row[ycolumn]) for row in chartdata] for ycolumn in self.ycolumns] ! self.legendlabels = [str(ycolumn) for ycolumn in self.ycolumns] self.xvalues = [dates.mktime(dates.WinPyTimeToDate(row[self.xcolumn])) - self.startDateVal for row in chartdata] --- 170,179 ---- def getdata(self): chartdata = self.charttable.gettablerows(self.filter) ! if chartdata == []: #No data ! self.ydata = [] ! self.legendlabels = None ! else: ! self.ydata = [[self.mapfromNone(row[ycolumn]) for row in chartdata] for ycolumn in self.ycolumns] ! self.legendlabels = [str(ycolumn) for ycolumn in self.ycolumns] self.xvalues = [dates.mktime(dates.WinPyTimeToDate(row[self.xcolumn])) - self.startDateVal for row in chartdata] |
From: <dav...@us...> - 2004-03-10 07:39:11
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20875 Modified Files: chart.py Log Message: Refactored LineChart into a line chart and a subclass which formats dates. The date line chart displays ten time labels uniformly spaced along the graph. Partial sets of data are now displayed correctly (although not null sets yet) Index: chart.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/chart.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** chart.py 8 Mar 2004 16:48:13 -0000 1.25 --- chart.py 10 Mar 2004 07:13:30 -0000 1.26 *************** *** 97,107 **** return img class LineChart(Chart): ! def __init__(self, charttable, xcolumn, ycolumns, xstorageformat='TEXT', xdisplay='', filter=None,xdisplay2=None): self.xcolumn = xcolumn self.ycolumns = ycolumns ! self.xstorageformat = xstorageformat ! self.xdisplay = xdisplay ! self.xdisplay2 = xdisplay2 Chart.__init__(self, charttable, filter) --- 97,107 ---- return img + #This class now assumes a text storage format for x values. See below for subclass which handles dates class LineChart(Chart): ! def __init__(self, charttable, xcolumn, ycolumns, startVal=None, endVal=None, filter=None): self.xcolumn = xcolumn self.ycolumns = ycolumns ! self.startVal = startVal ! self.endVal = endVal Chart.__init__(self, charttable, filter) *************** *** 114,129 **** def getdata(self): chartdata = self.charttable.gettablerows(self.filter) ! if self.xstorageformat == 'DATETIME': ! if self.xdisplay2: ! self.xdata = [dates.formatdate(chartdata[0][self.xcolumn], self.xdisplay)] ! self.xdata += [dates.formatdate(row[self.xcolumn],self.xdisplay2) for row in chartdata[1:-1]] ! self.xdata += [dates.formatdate(chartdata[-1][self.xcolumn], self.xdisplay)] ! else: ! self.xdata = [dates.formatdate(row[self.xcolumn],self.xdisplay) for row in chartdata] ! else: ! self.xdata = [str(row[self.xcolumn]) for row in chartdata] self.ydata = [[self.mapfromNone(row[ycolumn]) for row in chartdata] for ycolumn in self.ycolumns] self.legendlabels = [str(ycolumn) for ycolumn in self.ycolumns] def drawimage(self): #For now, x axis will be evenly spaced --- 114,128 ---- def getdata(self): chartdata = self.charttable.gettablerows(self.filter) ! self.xdata = [str(row[self.xcolumn]) for row in chartdata] self.ydata = [[self.mapfromNone(row[ycolumn]) for row in chartdata] for ycolumn in self.ycolumns] self.legendlabels = [str(ycolumn) for ycolumn in self.ycolumns] + #x axis tick labels should be uniformly distributed in this case + if self.startVal == None: + self.startVal = 0 + if self.endVal == None: + self.endVal = len(self.xdata) + self.xticks = self.xvalues = arange(self.startVal, self.endVal, float(self.endVal - self.startVal)/len(self.xdata)) + def drawimage(self): #For now, x axis will be evenly spaced *************** *** 144,181 **** ymax = value - self.figure.get_current_axis().set_xlim([0,len(self.xdata)+1]) self.figure.get_current_axis().set_ylim([math.floor(ymin),math.ceil(ymax)]) ! #Calculate number of x labels to use - between 6 and 10 ! #First see if anything divides nicely ! xDataLen = len(self.xdata) ! numLabels = None ! for testnum in range(5,10): ! if xDataLen % testnum == 0: ! numLabels = testnum+1 ! ! #Otherwise go for max ! if not numLabels: numLabels = 10 ! ! sliceNum = xDataLen / (numLabels-1) ! if not sliceNum: sliceNum = 1 ! ! currentxdata = self.xdata[:1] ! currentxpos = sliceNum ! while currentxpos < xDataLen: ! currentxdata.append(self.xdata[currentxpos]) ! currentxpos += sliceNum ! currentxdata.extend(self.xdata[-1:]) ! #Set the x labels ! self.figure.get_current_axis().set_xticks(arange(xDataLen+1,step=sliceNum)) ! self.figure.get_current_axis().set_xticklabels(currentxdata,rotation='vertical') #Plot each dataset for dataset in self.ydata: ! self.figure.get_current_axis().plot(dataset) #Draw a legend self.figure.get_current_axis().legend(self.legendlabels,2) class CurrentValueLegendChart(Chart): """This class creates a bar chart which acts as a legend and a current value reporter""" --- 143,189 ---- ymax = value self.figure.get_current_axis().set_ylim([math.floor(ymin),math.ceil(ymax)]) ! self.figure.get_current_axis().set_xticks(self.xticks) ! self.figure.get_current_axis().set_xticklabels(self.xdata,rotation='vertical') #Plot each dataset for dataset in self.ydata: ! self.figure.get_current_axis().plot(self.xvalues,dataset) ! ! self.figure.get_current_axis().set_xlim([self.startVal, self.endVal]) #Draw a legend self.figure.get_current_axis().legend(self.legendlabels,2) + NUM_TIME_LABELS = 10 + + class DateLineChart(LineChart): + def __init__(self, charttable, xcolumn, ycolumns, xdisplay, startDate=None, endDate=None, filter=None): + self.xdisplay = xdisplay + self.startDate = startDate + self.endDate = endDate + self.startDateVal = dates.mktime(startDate) + LineChart.__init__(self, charttable, xcolumn, ycolumns, 0, dates.mktime(endDate) - self.startDateVal, filter) + + def getdata(self): + chartdata = self.charttable.gettablerows(self.filter) + self.ydata = [[self.mapfromNone(row[ycolumn]) for row in chartdata] for ycolumn in self.ycolumns] + self.legendlabels = [str(ycolumn) for ycolumn in self.ycolumns] + self.xvalues = [dates.mktime(dates.WinPyTimeToDate(row[self.xcolumn])) - self.startDateVal for row in chartdata] + + if self.startDate == None: + self.startDate = dates.WinPyTimeToDate(chartdata[0][self.xcolumn]) + if self.endDate == None: + self.endDate = dates.WinPyTimeToDate(chartdata[-1][self.xcolumn]) + timeStep = (self.endDate - self.startDate) / NUM_TIME_LABELS + + self.xdata = [] + self.xticks = [] + for i in range(NUM_TIME_LABELS+1): + labelDate = self.startDate+(timeStep*i) + self.xdata.append(dates.formatdate(labelDate,self.xdisplay)) + self.xticks.append(dates.mktime(labelDate) - self.startDateVal) + class CurrentValueLegendChart(Chart): """This class creates a bar chart which acts as a legend and a current value reporter""" |
From: <dav...@us...> - 2004-03-10 07:38:27
|
Update of /cvsroot/jtoolkit/jToolkit/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20722 Modified Files: dates.py Log Message: Added a function which returns time as a floating point from a date. Added a function which creates a date from a pywintypes.PyTime object Index: dates.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/data/dates.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** dates.py 10 Mar 2004 06:58:42 -0000 1.17 --- dates.py 10 Mar 2004 07:12:46 -0000 1.18 *************** *** 19,22 **** --- 19,23 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + import time try: import datetime *************** *** 37,40 **** --- 38,45 ---- def datetimedelta(days=0, hours=0, minutes=0, seconds=0): return mxDateTime.DateTimeDelta(days, hours, minutes, seconds) + + #Returns a unique floating point number for that date + def mktime(date): + return time.mktime(date.tuple()) else: date = datetime.datetime *************** *** 46,54 **** def days(numdays): return datetime.timedelta(days=numdays) from jToolkit import cidict import sre - import time - # we have copied _strptime from Python2.3 so that it can be used in earlier versions --- 51,61 ---- def days(numdays): return datetime.timedelta(days=numdays) + + #Returns a unique floating point number for that date + def mktime(date): + return time.mktime(date.timetuple()) from jToolkit import cidict import sre # we have copied _strptime from Python2.3 so that it can be used in earlier versions *************** *** 233,234 **** --- 240,245 ---- return value.abstime + def WinPyTimeToDate(pytime): + """Converts a pywintypes.PyTime object into a date object""" + return date(pytime.year, pytime.month, pytime.day, pytime.hour, pytime.minute, pytime.second) + |
From: <dav...@us...> - 2004-03-10 07:27:00
|
Update of /cvsroot/jtoolkit/jToolkit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18564 Modified Files: errors.py Log Message: did another fix that really fixes the types problem... Index: errors.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/errors.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** errors.py 10 Mar 2004 07:00:25 -0000 1.7 --- errors.py 10 Mar 2004 07:01:19 -0000 1.8 *************** *** 25,39 **** import time - # pywintypes has an error in time formatting, so we need to be able to detect this type on windows - # (copied from data/dates.py) - try: - import pywintypes - errortimetype = pywintypes.TimEType - except ImportError: - errortimetype = None - except AttributeError: - # TODO: write an error message - this means that pywintypes needs to be patched for __file__ AttributeError - errortimetype = None - # TODO: add apache logging (into apache log files) --- 25,28 ---- *************** *** 77,82 **** def tounicode(value): if type(value) == str: return value.decode('iso8859') ! elif type(value) == errortimetype: return repr(value) ! else: return unicode(value) if recorddict is not None: recordstr = ', '.join([key + ':' + tounicode(value) for key, value in recorddict.iteritems()]) --- 66,74 ---- def tounicode(value): if type(value) == str: return value.decode('iso8859') ! else: ! try: ! return unicode(value) ! except ValueError: ! return unicode(repr(value)) if recorddict is not None: recordstr = ', '.join([key + ':' + tounicode(value) for key, value in recorddict.iteritems()]) |
From: <dav...@us...> - 2004-03-10 07:26:05
|
Update of /cvsroot/jtoolkit/jToolkit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18361 Modified Files: errors.py Log Message: added special handling of errortimetype for logaudit... Index: errors.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/errors.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** errors.py 10 Feb 2004 08:08:55 -0000 1.6 --- errors.py 10 Mar 2004 07:00:25 -0000 1.7 *************** *** 25,28 **** --- 25,39 ---- import time + # pywintypes has an error in time formatting, so we need to be able to detect this type on windows + # (copied from data/dates.py) + try: + import pywintypes + errortimetype = pywintypes.TimEType + except ImportError: + errortimetype = None + except AttributeError: + # TODO: write an error message - this means that pywintypes needs to be patched for __file__ AttributeError + errortimetype = None + # TODO: add apache logging (into apache log files) *************** *** 66,69 **** --- 77,81 ---- def tounicode(value): if type(value) == str: return value.decode('iso8859') + elif type(value) == errortimetype: return repr(value) else: return unicode(value) if recorddict is not None: |
From: <dav...@us...> - 2004-03-10 07:24:22
|
Update of /cvsroot/jtoolkit/jToolkit/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18007 Modified Files: dates.py Log Message: handle unicode date formatting strings... Index: dates.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/data/dates.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** dates.py 10 Mar 2004 06:56:49 -0000 1.16 --- dates.py 10 Mar 2004 06:58:42 -0000 1.17 *************** *** 208,211 **** --- 208,213 ---- value = date(value.year, value.month, value.day, value.hour, value.minute, value.second) if hasattr(value,'strftime'): + if type(dateformat) == unicode: + dateformat = dateformat.encode('iso-8859-1') return value.strftime(dateformat) # handle null values |
From: <dav...@us...> - 2004-03-10 07:22:31
|
Update of /cvsroot/jtoolkit/jToolkit/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17658 Modified Files: dates.py Log Message: added back in (more intelligent) support for avoiding pywintypes problems with formatting... Index: dates.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/data/dates.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** dates.py 10 Mar 2004 06:55:24 -0000 1.15 --- dates.py 10 Mar 2004 06:56:49 -0000 1.16 *************** *** 57,60 **** --- 57,69 ---- time.strptime = _strptime.strptime + # pywintypes has an error in time formatting, so we need to be able to detect this type on windows + try: + import pywintypes + errortimetype = pywintypes.TimeType + except ImportError: + errortimetype = None + except AttributeError: + # TODO: write an error message - this means that pywintypes needs to be patched for __file__ AttributeError + errortimetype = None class ParseError(ValueError): *************** *** 195,202 **** else: dateformat = formattype if hasattr(value,'strftime'): return value.strftime(dateformat) - elif hasattr(value,'Format'): - return value.Format(dateformat) # handle null values elif value is None or value == '': --- 204,212 ---- else: dateformat = formattype + # pywintypes.TimeType can't handle dates before 1970 + if type(value) == errortimetype: + value = date(value.year, value.month, value.day, value.hour, value.minute, value.second) if hasattr(value,'strftime'): return value.strftime(dateformat) # handle null values elif value is None or value == '': |
From: <dav...@us...> - 2004-03-10 07:21:05
|
Update of /cvsroot/jtoolkit/jToolkit/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17439 Modified Files: dates.py Log Message: Put back Format method for sake of Windows COM PyTime type... Index: dates.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/data/dates.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** dates.py 10 Mar 2004 06:53:02 -0000 1.14 --- dates.py 10 Mar 2004 06:55:24 -0000 1.15 *************** *** 197,200 **** --- 197,202 ---- if hasattr(value,'strftime'): return value.strftime(dateformat) + elif hasattr(value,'Format'): + return value.Format(dateformat) # handle null values elif value is None or value == '': |
From: <dav...@us...> - 2004-03-10 07:18:42
|
Update of /cvsroot/jtoolkit/jToolkit/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16985 Modified Files: dates.py Log Message: replacing seconds and days classes with functions (somehow the classes lost the keyword when passing to the constructor and generated incorrect values) Index: dates.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/data/dates.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** dates.py 9 Mar 2004 21:29:16 -0000 1.13 --- dates.py 10 Mar 2004 06:53:02 -0000 1.14 *************** *** 41,51 **** currentdate = datetime.datetime.now datetimedelta = datetime.timedelta ! class seconds(datetime.timedelta): ! def __init__(self, seconds = 0): ! datetime.timedelta.__init__(self, seconds=seconds) ! class days(datetime.timedelta): ! def __init__(self, days = 0): ! datetime.timedelta.__init__(self, days=days) from jToolkit import cidict --- 41,49 ---- currentdate = datetime.datetime.now datetimedelta = datetime.timedelta ! def seconds(numseconds): ! return datetime.timedelta(seconds=numseconds) ! def days(numdays): ! return datetime.timedelta(days=numdays) from jToolkit import cidict |
From: <dav...@us...> - 2004-03-09 21:54:39
|
Update of /cvsroot/jtoolkit/jToolkit/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10180 Modified Files: dates.py database.py Log Message: added functions to return the date and time parts of a date updated database.py to handle detection of datetime types... Index: dates.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/data/dates.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** dates.py 9 Mar 2004 21:28:13 -0000 1.12 --- dates.py 9 Mar 2004 21:29:16 -0000 1.13 *************** *** 207,208 **** --- 207,222 ---- raise ValueError, "unexpected type in formatdate: %r, %r" % (value, type(value)) + def datepart(value): + """returns the date part of a datetime value""" + if PYTHON_DATETIME: + return value.date() + else: + return value.absdate + + def timepart(value): + """returns the time part of a datetime value""" + if PYTHON_DATETIME: + return value.time() + else: + return value.abstime + Index: database.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/data/database.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** database.py 9 Feb 2004 14:40:57 -0000 1.20 --- database.py 9 Mar 2004 21:29:16 -0000 1.21 *************** *** 320,323 **** --- 320,325 ---- raise return dates.dbdatestring(value, self.DBTYPE) + elif type(value) == dates.date: + return dates.dbdatestring(value, self.DBTYPE) elif type(value).__name__ == 'DateTime': return dates.dbdatestring(value, self.DBTYPE) |
From: <dav...@us...> - 2004-03-09 21:54:13
|
Update of /cvsroot/jtoolkit/jToolkit/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10053 Modified Files: session.py Log Message: updated to use proper generic date formatting code Index: session.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/web/session.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** session.py 9 Feb 2004 14:24:09 -0000 1.8 --- session.py 9 Mar 2004 21:28:50 -0000 1.9 *************** *** 64,68 **** language = argdict.get('language','') # create a new session ! timestamp = dates.currentdate().Format('%Y%m%d%H%M%S') session = self.createsession(server) session.create(username,password,timestamp,language) --- 64,68 ---- language = argdict.get('language','') # create a new session ! timestamp = dates.formatdate(dates.currentdate(), '%Y%m%d%H%M%S') session = self.createsession(server) session.create(username,password,timestamp,language) *************** *** 79,83 **** password = argdict.get('password','') session = self.getsession(req, server) ! timestamp = dates.currentdate().Format('%Y%m%d%H%M%S') session.confirmlogin(req, username, password, timestamp) return session --- 79,83 ---- password = argdict.get('password','') session = self.getsession(req, server) ! timestamp = dates.formatdate(dates.currentdate(), '%Y%m%d%H%M%S') session.confirmlogin(req, username, password, timestamp) return session *************** *** 372,376 **** password = getattr(self, 'password', '') language = self.language ! timestamp = dates.currentdate().Format('%Y%m%d%H%M%S') # currently assumes we do not need to close the other session otherusername = getattr(othersession, 'username', '') --- 372,376 ---- password = getattr(self, 'password', '') language = self.language ! timestamp = dates.formatdate(dates.currentdate(), '%Y%m%d%H%M%S') # currently assumes we do not need to close the other session otherusername = getattr(othersession, 'username', '') |
From: <dav...@us...> - 2004-03-09 21:53:36
|
Update of /cvsroot/jtoolkit/jToolkit/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9967 Modified Files: dates.py Log Message: cleaned up old code to handle old error in PyTime's formatting code (for weekdays) updated references to Format to strftime... Index: dates.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/data/dates.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** dates.py 9 Mar 2004 21:27:50 -0000 1.11 --- dates.py 9 Mar 2004 21:28:13 -0000 1.12 *************** *** 54,61 **** - # TODO: support Python 2.3 datetime - # see http://radio.weblogs.com/0124960/2003/09/11.html - # aDateObj = datetime.datetime.fromtimestamp(time.mktime(time.strptime(aDateString, dateParseFormat))) - # we have copied _strptime from Python2.3 so that it can be used in earlier versions if not hasattr(time, 'strptime'): --- 54,57 ---- *************** *** 63,76 **** time.strptime = _strptime.strptime - # pywintypes has an error in time formatting, so we need to be able to detect this type on windows - try: - import pywintypes - errortimetype = pywintypes.TimeType - except ImportError: - errortimetype = None - except AttributeError: - # TODO: write an error message - this means that pywintypes needs to be patched for __file__ AttributeError - errortimetype = None - class ParseError(ValueError): --- 59,62 ---- *************** *** 153,157 **** return dbdatestring(self.obj,self.dbtype) def strftime(self,*args): ! """allow passthrough to underlying object's Format method""" return self.obj.strftime(*args) --- 139,143 ---- return dbdatestring(self.obj,self.dbtype) def strftime(self,*args): ! """allow passthrough to underlying object's strftime method""" return self.obj.strftime(*args) *************** *** 211,219 **** else: dateformat = formattype ! if hasattr(value,'Format'): ! # this is to correct an error in PyTime.Format (always displays weekday as Sunday) ! # TODO: remove this if the error is fixed ! if type(value) == errortimetype: ! value = date(value.year, value.month, value.day, value.hour, value.minute, value.second) return value.strftime(dateformat) # handle null values --- 197,201 ---- else: dateformat = formattype ! if hasattr(value,'strftime'): return value.strftime(dateformat) # handle null values |
From: <dav...@us...> - 2004-03-09 21:53:12
|
Update of /cvsroot/jtoolkit/jToolkit/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9896 Modified Files: dates.py Log Message: Added support in dates module for Python 2.3 datetime object (added a few wrapper classes, changed Format() calls to strftime() calls) Index: dates.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/data/dates.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dates.py 9 Mar 2004 21:25:57 -0000 1.10 --- dates.py 9 Mar 2004 21:27:50 -0000 1.11 *************** *** 20,30 **** try: ! import mxDateTime ! except ImportError: ! from DateTime import mxDateTime from jToolkit import cidict import sre import time # TODO: support Python 2.3 datetime # see http://radio.weblogs.com/0124960/2003/09/11.html --- 20,57 ---- try: ! import datetime ! PYTHON_DATETIME = 1 ! except: ! PYTHON_DATETIME = 0 ! ! if not PYTHON_DATETIME: ! try: ! import mxDateTime ! except ImportError: ! from DateTime import mxDateTime ! ! date = mxDateTime.DateTime ! currentdate = mxDateTime.now ! seconds = mxDateTime.DateTimeDeltaFromSeconds ! days = mxDateTime.DateTimeDeltaFromDays ! def datetimedelta(days=0, hours=0, minutes=0, seconds=0): ! return mxDateTime.DateTimeDelta(days, hours, minutes, seconds) ! else: ! date = datetime.datetime ! currentdate = datetime.datetime.now ! datetimedelta = datetime.timedelta ! class seconds(datetime.timedelta): ! def __init__(self, seconds = 0): ! datetime.timedelta.__init__(self, seconds=seconds) ! ! class days(datetime.timedelta): ! def __init__(self, days = 0): ! datetime.timedelta.__init__(self, days=days) ! from jToolkit import cidict import sre import time + # TODO: support Python 2.3 datetime # see http://radio.weblogs.com/0124960/2003/09/11.html *************** *** 46,53 **** errortimetype = None - date = mxDateTime.DateTime - currentdate = mxDateTime.now - seconds = mxDateTime.DateTimeDeltaFromSeconds - days = mxDateTime.DateTimeDeltaFromDays class ParseError(ValueError): --- 73,76 ---- *************** *** 77,81 **** if value is None: del g[key] ! now = currentdate().tuple() Y, M, D, h, m, s = [g.get(field,"0") for field in 'Y','M','D','h','m','s'] # for two-digit years, get closest year --- 100,107 ---- if value is None: del g[key] ! if PYTHON_DATETIME: ! now = currentdate().timetuple() ! else: ! now = currentdate().tuple() Y, M, D, h, m, s = [g.get(field,"0") for field in 'Y','M','D','h','m','s'] # for two-digit years, get closest year *************** *** 107,117 **** def dbdatestring(obj,dbtype): if dbtype == 'oracle': ! return "to_date('"+obj.Format("%Y-%m-%d %H:%M:%S")+"','yyyy-mm-dd hh24:mi:ss')" elif dbtype == 'sqlserver': ! return "'"+obj.Format("%Y-%m-%d %H:%M:%S")+"'" elif dbtype == 'access': ! return "#"+obj.Format("%Y-%m-%d %H:%M:%S")+"#" elif dbtype == 'postgres': ! return "to_timestamp('"+obj.Format("%Y-%m-%d %H:%M:%S")+"','yyyy-mm-dd hh24:mi:ss')" else: raise ValueError, "unknown dbtype %r" % dbtype --- 133,143 ---- def dbdatestring(obj,dbtype): if dbtype == 'oracle': ! return "to_date('"+obj.strftime("%Y-%m-%d %H:%M:%S")+"','yyyy-mm-dd hh24:mi:ss')" elif dbtype == 'sqlserver': ! return "'"+obj.strftime("%Y-%m-%d %H:%M:%S")+"'" elif dbtype == 'access': ! return "#"+obj.strftime("%Y-%m-%d %H:%M:%S")+"#" elif dbtype == 'postgres': ! return "to_timestamp('"+obj.strftime("%Y-%m-%d %H:%M:%S")+"','yyyy-mm-dd hh24:mi:ss')" else: raise ValueError, "unknown dbtype %r" % dbtype *************** *** 126,132 **** def dbrepr(self): return dbdatestring(self.obj,self.dbtype) ! def Format(self,*args): """allow passthrough to underlying object's Format method""" ! return self.obj.Format(*args) # generally used date formats --- 152,158 ---- def dbrepr(self): return dbdatestring(self.obj,self.dbtype) ! def strftime(self,*args): """allow passthrough to underlying object's Format method""" ! return self.obj.strftime(*args) # generally used date formats *************** *** 190,194 **** if type(value) == errortimetype: value = date(value.year, value.month, value.day, value.hour, value.minute, value.second) ! return value.Format(dateformat) # handle null values elif value is None or value == '': --- 216,220 ---- if type(value) == errortimetype: value = date(value.year, value.month, value.day, value.hour, value.minute, value.second) ! return value.strftime(dateformat) # handle null values elif value is None or value == '': |
From: <dav...@us...> - 2004-03-09 21:51:23
|
Update of /cvsroot/jtoolkit/jToolkit/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9419 Modified Files: dates.py Log Message: Changed one instance of mxDateTime.DateTime to use the assignment "date" Index: dates.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/data/dates.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dates.py 9 Mar 2004 21:20:57 -0000 1.9 --- dates.py 9 Mar 2004 21:25:57 -0000 1.10 *************** *** 189,193 **** # TODO: remove this if the error is fixed if type(value) == errortimetype: ! value = mxDateTime.DateTime(value.year, value.month, value.day, value.hour, value.minute, value.second) return value.Format(dateformat) # handle null values --- 189,193 ---- # TODO: remove this if the error is fixed if type(value) == errortimetype: ! value = date(value.year, value.month, value.day, value.hour, value.minute, value.second) return value.Format(dateformat) # handle null values |
From: <dav...@us...> - 2004-03-09 21:49:46
|
Update of /cvsroot/jtoolkit/jToolkit/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9117 Modified Files: _PyADO.py Log Message: backing out classname detection as it only works if the typelibrary has already been registered Added a TODO to do this properly... Index: _PyADO.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/data/_PyADO.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** _PyADO.py 9 Mar 2004 21:23:37 -0000 1.4 --- _PyADO.py 9 Mar 2004 21:24:22 -0000 1.5 *************** *** 37,41 **** print "creating jToolkit.data.ADODB class library to speed up database operations..." conn = win32com.client.Dispatch("ADODB.Connection") ! classname = sys.modules[conn.__class__.__module__].__doc__ pyclassfilename = os.path.join(os.path.dirname(__file__), 'ADODB.py') pyclassfile = open(pyclassfilename, 'w') --- 37,43 ---- print "creating jToolkit.data.ADODB class library to speed up database operations..." conn = win32com.client.Dispatch("ADODB.Connection") ! version = str(conn.Version) ! # TODO: work out a real way to determine the Type Library name... ! classname = "Microsoft ActiveX Data Objects %s Library" % version pyclassfilename = os.path.join(os.path.dirname(__file__), 'ADODB.py') pyclassfile = open(pyclassfilename, 'w') |
From: <dav...@us...> - 2004-03-09 21:49:13
|
Update of /cvsroot/jtoolkit/jToolkit/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8983 Modified Files: _PyADO.py Log Message: Changed to more robust way of getting the classname. Generating ADO shortcuts cannot use a GUI progress under Apache, so it has been changed to use a simple progress Index: _PyADO.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/data/_PyADO.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** _PyADO.py 9 Mar 2004 21:20:20 -0000 1.3 --- _PyADO.py 9 Mar 2004 21:23:37 -0000 1.4 *************** *** 37,46 **** print "creating jToolkit.data.ADODB class library to speed up database operations..." conn = win32com.client.Dispatch("ADODB.Connection") ! version = str(conn.Version) ! classname = "Microsoft ActiveX Data Objects %s Library" % version pyclassfilename = os.path.join(os.path.dirname(__file__), 'ADODB.py') pyclassfile = open(pyclassfilename, 'w') print "creating %s for %s" % (pyclassfile, classname) ! makepy.GenerateFromTypeLibSpec(classname, pyclassfile) pyclassfile.close() if not os.path.getsize(pyclassfilename): --- 37,45 ---- print "creating jToolkit.data.ADODB class library to speed up database operations..." conn = win32com.client.Dispatch("ADODB.Connection") ! classname = sys.modules[conn.__class__.__module__].__doc__ pyclassfilename = os.path.join(os.path.dirname(__file__), 'ADODB.py') pyclassfile = open(pyclassfilename, 'w') print "creating %s for %s" % (pyclassfile, classname) ! makepy.GenerateFromTypeLibSpec(classname, pyclassfile, progressInstance=makepy.SimpleProgress(0)) pyclassfile.close() if not os.path.getsize(pyclassfilename): |
From: <dav...@us...> - 2004-03-09 21:46:20
|
Update of /cvsroot/jtoolkit/jToolkit/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8247 Modified Files: dates.py _strptime.py Log Message: converted to allow importing mxDateTime module directly... Index: dates.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/data/dates.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dates.py 9 Feb 2004 13:48:20 -0000 1.8 --- dates.py 9 Mar 2004 21:20:57 -0000 1.9 *************** *** 19,23 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! from DateTime import mxDateTime from jToolkit import cidict import sre --- 19,26 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! try: ! import mxDateTime ! except ImportError: ! from DateTime import mxDateTime from jToolkit import cidict import sre Index: _strptime.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/data/_strptime.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _strptime.py 25 Sep 2003 18:10:51 -0000 1.1 --- _strptime.py 9 Mar 2004 21:20:57 -0000 1.2 *************** *** 24,28 **** except ImportError: # compatibility mode for Python 2.2 without datetime module ! from DateTime import mxDateTime class datetime_date: fromordinal = mxDateTime.DateTimeFromAbsDays --- 24,31 ---- except ImportError: # compatibility mode for Python 2.2 without datetime module ! try: ! import mxDateTime ! except ImportError: ! from DateTime import mxDateTime class datetime_date: fromordinal = mxDateTime.DateTimeFromAbsDays |
From: <dav...@us...> - 2004-03-09 21:45:41
|
Update of /cvsroot/jtoolkit/jToolkit/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8053 Modified Files: _PyADO.py Log Message: changed hex constant to LONG to avoid FutureWarning on Python 2.3 (should stil work with Python 2.2) Index: _PyADO.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/data/_PyADO.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** _PyADO.py 9 Feb 2004 14:04:47 -0000 1.2 --- _PyADO.py 9 Mar 2004 21:20:20 -0000 1.3 *************** *** 25,28 **** --- 25,56 ---- import win32com.client + try: + from jToolkit.data import ADODB + if not hasattr(ADODB, "Connection"): + print "Connection not found in jToolkit.data.ADODB: remove %s to recreate it" % ADODB.__file__ + ADODB = None + except ImportError: + import sys + import os.path + from win32com.client import makepy + # get version from test connection + print "creating jToolkit.data.ADODB class library to speed up database operations..." + conn = win32com.client.Dispatch("ADODB.Connection") + version = str(conn.Version) + classname = "Microsoft ActiveX Data Objects %s Library" % version + pyclassfilename = os.path.join(os.path.dirname(__file__), 'ADODB.py') + pyclassfile = open(pyclassfilename, 'w') + print "creating %s for %s" % (pyclassfile, classname) + makepy.GenerateFromTypeLibSpec(classname, pyclassfile) + pyclassfile.close() + if not os.path.getsize(pyclassfilename): + print "ADO class creation unsuccessful... removing" + os.remove(pyclassfilename) + try: + from jToolkit.data import ADODB + except ImportError: + print "could not import ADODB module even after attempted recreation: running slowly..." + ADODB = None + CoInitialize = win32com.client.pythoncom.CoInitialize error = pythoncom.error *************** *** 40,46 **** def __init__(self): try: ! self.Conn = win32com.client.Dispatch("ADODB.Connection") except win32com.client.pythoncom.com_error, com_error: ! if com_error.args[0] == 0x800401f0: # this is the COM not initialized problem raise WindowsError("COM not initialized") --- 68,77 ---- def __init__(self): try: ! if ADODB: ! self.Conn = ADODB.Connection() ! else: ! self.Conn = win32com.client.Dispatch("ADODB.Connection") except win32com.client.pythoncom.com_error, com_error: ! if com_error.args[0] == 0x800401f0L: # this is the COM not initialized problem raise WindowsError("COM not initialized") *************** *** 93,97 **** class Recordset(object): def __init__(self): ! self.rs = win32com.client.Dispatch("ADODB.Recordset") def Open(self, operation, ActiveConnection): return self.rs.Open(operation, ActiveConnection.Conn) --- 124,131 ---- class Recordset(object): def __init__(self): ! if ADODB: ! self.rs = ADODB.Recordset() ! else: ! self.rs = win32com.client.Dispatch("ADODB.Recordset") def Open(self, operation, ActiveConnection): return self.rs.Open(operation, ActiveConnection.Conn) |
From: <dav...@us...> - 2004-03-09 21:45:07
|
Update of /cvsroot/jtoolkit/jToolkit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7923 Modified Files: timecache.py Log Message: completed timecache methods corrected repr, iterator methods... Index: timecache.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/timecache.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** timecache.py 25 Sep 2003 17:36:55 -0000 1.3 --- timecache.py 9 Mar 2004 21:19:45 -0000 1.4 *************** *** 21,24 **** --- 21,26 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # TODO: remove when python2.2 support is dropped... + from __future__ import generators from jToolkit.data import dates *************** *** 26,29 **** --- 28,32 ---- """caches objects, remembers time, and dumps when neccessary...""" def __init__(self, expiryperiod): + """constructs a timecache dictionary with an expiryperiod given in seconds...""" dict.__init__(self) self.expiryperiod = dates.seconds(expiryperiod) *************** *** 34,37 **** --- 37,41 ---- def gettimestamp(self): + """returns a new timestamp for the current time...""" return dates.currentdate() *************** *** 69,74 **** def __repr__(self): self.purge() ! return dict.__repr__(self) def __setitem__(self, key, value): --- 73,79 ---- def __repr__(self): + """x.__repr__() <==> repr(x)""" self.purge() ! return repr(dict(self.items())) def __setitem__(self, key, value): *************** *** 91,119 **** return value - # FIXME: remove all the timestamps from the iterator functions def items(self): self.purge() ! return dict.items(self) def iteritems(self): self.purge() ! return dict.iteritems(self) def iterkeys(self): self.purge() return dict.iterkeys(self) def itervalues(self): self.purge() ! return dict.itervalues(self) def keys(self): self.purge() return dict.keys(self) def values(self): self.purge() ! return dict.values(self) ! # TODO: still to implement: popitem, setdefault, update --- 96,150 ---- return value def items(self): + """D.items() -> list of D's (key, value) pairs, as 2-tuples""" self.purge() ! return [(key, value) for (key, (timestamp, value)) in dict.items(self)] def iteritems(self): + """D.iteritems() -> an iterator over the (key, value) items of D""" self.purge() ! for key, (timestamp, value) in dict.iteritems(self): ! yield (key, value) def iterkeys(self): + """D.iterkeys() -> an iterator over the keys of D""" self.purge() return dict.iterkeys(self) def itervalues(self): + """D.itervalues() -> an iterator over the values of D""" self.purge() ! for timestamp, value in dict.itervalues(self): ! yield value def keys(self): + """D.keys() -> list of D's keys""" self.purge() return dict.keys(self) def values(self): + """D.values() -> list of D's values""" self.purge() ! return [value for (timestamp, value) in dict.values(self)] ! def popitem(self): ! """D.popitem() -> (k, v), remove and return some (key, value) pair as a ! 2-tuple; but raise KeyError if D is empty""" ! self.purge() ! key, (timestamp, value) = dict.popitem(self) ! return (key, value) ! ! def setdefault(self, key, failobj=None): ! """D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D""" ! newtimestamp = self.gettimestamp() ! oldtimestamp, value = dict.setdefault(self, key, (newtimestamp, failobj)) ! if self.expired(oldtimestamp): ! dict.__setitem__(self, key, (newtimestamp, failobj)) ! return failobj ! return value ! ! def update(self, updatedict): ! """D.update(E) -> None. Update D from E: for k in E.keys(): D[k] = E[k]""" ! for key in updatedict.keys(): ! self[key] = updatedict[key] |
From: <dav...@us...> - 2004-03-09 21:21:24
|
Update of /cvsroot/jtoolkit/jToolkit/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1200 Added Files: .cvsignore Log Message: Added .cvsignore file to prevent the ADODB module from being added to CVS... (It should be recreated on each users machine...) --- NEW FILE: .cvsignore --- *.pyc ADODB.py |
From: <dav...@us...> - 2004-03-08 17:18:37
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28485 Modified Files: widgets.py Log Message: fixed call to escape that was meant to be call to escapeattribvalue result was that everything said "value" instead of the real value... Index: widgets.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/widgets.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** widgets.py 8 Mar 2004 16:51:15 -0000 1.22 --- widgets.py 8 Mar 2004 16:54:10 -0000 1.23 *************** *** 74,78 **** quotedvalue = self.escapeattribvalue(key, attribstring) else: ! quotedvalue = self.escape(key, str(value)) return self.escape(str(key)) + '=' + quotedvalue --- 74,78 ---- quotedvalue = self.escapeattribvalue(key, attribstring) else: ! quotedvalue = self.escapeattribvalue(key, str(value)) return self.escape(str(key)) + '=' + quotedvalue |
From: <dav...@us...> - 2004-03-08 17:15:45
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27369 Modified Files: widgets.py Log Message: refactored so escaping can be taylored for an attribute key this lets us escape hrefs in links, but not tooltips Index: widgets.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/widgets.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** widgets.py 10 Feb 2004 09:21:30 -0000 1.21 --- widgets.py 8 Mar 2004 16:51:15 -0000 1.22 *************** *** 61,74 **** return s def gethtmlattrib(self, key, value): """turns the key and value into something usable as an html attribute and value...""" valuetype = type(value) if valuetype == str or valuetype == unicode: ! quotedvalue = self.escape(value, quote=1) elif valuetype == dict: attribstring = "; ".join(["%s: %s" % (str(subkey), str(subvalue)) for subkey,subvalue in value.iteritems()]) ! quotedvalue = self.escape(attribstring, quote=1) else: ! quotedvalue = self.escape(str(value), quote=1) return self.escape(str(key)) + '=' + quotedvalue --- 61,78 ---- return s + def escapeattribvalue(self, key, value): + """returns the value escaped appropriately for the key...""" + return self.escape(value, quote=1) + def gethtmlattrib(self, key, value): """turns the key and value into something usable as an html attribute and value...""" valuetype = type(value) if valuetype == str or valuetype == unicode: ! quotedvalue = self.escapeattribvalue(key, value) elif valuetype == dict: attribstring = "; ".join(["%s: %s" % (str(subkey), str(subvalue)) for subkey,subvalue in value.iteritems()]) ! quotedvalue = self.escapeattribvalue(key, attribstring) else: ! quotedvalue = self.escape(key, str(value)) return self.escape(str(key)) + '=' + quotedvalue *************** *** 203,209 **** self.overrideattribs(newattribs) ! def escape(self, s, quote=None): ! """Replace special characters &, <, >, add and handle quotes if asked""" ! return ContentWidget.escape(self, s, quote).replace(" ", "%20") class Tooltip(ContentWidget): --- 207,216 ---- self.overrideattribs(newattribs) ! def escapeattribvalue(self, key, value): ! """returns the value escaped appropriately for the key...""" ! if key.lower() == 'href': ! return self.escape(value, quote=1).replace(" ", "%20") ! else: ! return self.escape(value, quote=1) class Tooltip(ContentWidget): |
From: <dav...@us...> - 2004-03-08 17:15:12
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27211 Modified Files: table.py Log Message: Unicode problems sneak up on you in the unlikeliest of places ... apply the same fix used in getcontents to getrowcontents... (this probably makes it unneccessary in getcontents as well...) Index: table.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/table.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** table.py 9 Feb 2004 14:05:41 -0000 1.5 --- table.py 8 Mar 2004 16:50:45 -0000 1.6 *************** *** 113,122 **** def getrowcontents(self, rownum): ! htmlstring = "<tr>" ! for colnum in self.colrange(): ! cell = self.getcell(rownum, colnum) ! htmlstring += cell.gethtml() ! htmlstring += "</tr>\r" ! return htmlstring def getcontents(self): --- 113,124 ---- def getrowcontents(self, rownum): ! contentslist = [self.getcell(rownum, colnum).gethtml() for colnum in self.colrange()] ! # TODO: investigate ways to neaten this up while still preventing ASCII decoding error... ! typelist = [type(p) for p in contentslist] ! if unicode in typelist and str in typelist: ! for n in range(len(contentslist)): ! if type(contentslist[n]) == str: ! contentslist[n] = contentslist[n].decode('iso8859') ! return "<tr>" + "".join(contentslist) + "</tr>\r" def getcontents(self): |
From: <dav...@us...> - 2004-03-08 17:13:46
|
Update of /cvsroot/jtoolkit/jToolkit/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26688 Modified Files: server.py Log Message: updated etag support for backwards compatibility with mod_python 2.7.x Index: server.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/web/server.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** server.py 9 Feb 2004 14:27:32 -0000 1.9 --- server.py 8 Mar 2004 16:49:20 -0000 1.10 *************** *** 199,205 **** if getattr(thepage, 'etag', None): req.headers_out.add('Etag', thepage.etag) ! reqetag = req.headers_in.get('If-None-Match', '') ! if reqetag == thepage.etag: ! return httpcodes.NOT_MODIFIED if isinstance(thepage, widgets.Widget): # get the content type... --- 199,208 ---- if getattr(thepage, 'etag', None): req.headers_out.add('Etag', thepage.etag) ! # TODO: remove this when support for mod_python 2.x is no longer required ! # it could use req.headers_in.get in mod_python 3.x ! if req.headers_in.has_key('If-None-Match'): ! reqetag = req.headers_in['If-None-Match'] ! if reqetag == thepage.etag: ! return httpcodes.NOT_MODIFIED if isinstance(thepage, widgets.Widget): # get the content type... |
From: <dav...@us...> - 2004-03-08 17:12:42
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26414 Modified Files: chart.py Log Message: Adapted chart to matplotlib 0.50 Index: chart.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/chart.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** chart.py 8 Mar 2004 16:41:21 -0000 1.24 --- chart.py 8 Mar 2004 16:48:13 -0000 1.25 *************** *** 34,38 **** self.chartType = LINE_CHART if not hasattr(self, 'dpi'): ! self.dpi = 50 self.options = {} --- 34,38 ---- self.chartType = LINE_CHART if not hasattr(self, 'dpi'): ! self.dpi = 100 self.options = {} *************** *** 54,59 **** def sizeimage(self): """Subclasses of this should implement this uniquely""" ! self.im_width = 17.5 ! self.im_height = 9 def option(self, **args): --- 54,59 ---- def sizeimage(self): """Subclasses of this should implement this uniquely""" ! self.im_width = 8.75 ! self.im_height = 4.5 def option(self, **args): *************** *** 68,72 **** try: tempfilename = str(random.randint(100000,999999)) + '.png' ! self.figure.figure.print_figure(tempfilename,self.dpi) #Read and report --- 68,75 ---- try: tempfilename = str(random.randint(100000,999999)) + '.png' ! if hasattr(self.figure,'figure'): ! self.figure.figure.print_figure(tempfilename,self.dpi) ! else: #matplotlib 0.50 ! self.figure.canvas.print_figure(tempfilename,self.dpi) #Read and report *************** *** 228,233 **** def sizeimage(self): ! self.im_width = 6 ! self.im_height = 8 #This should take tagname length into account --- 231,236 ---- def sizeimage(self): ! self.im_width = 3 ! self.im_height = 4 #This should take tagname length into account |