[Hepserver-commits] hep/hep/web models.py,1.1,1.2
Status: Alpha
Brought to you by:
abefettig
|
From: <abe...@us...> - 2003-08-07 03:28:58
|
Update of /cvsroot/hepserver/hep/hep/web
In directory sc8-pr-cvs1:/tmp/cvs-serv15165/hep/web
Modified Files:
models.py
Log Message:
use new message API with dict-like interface
for headers (still in flux).
Index: models.py
===================================================================
RCS file: /cvsroot/hepserver/hep/hep/web/models.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** models.py 10 Jul 2003 16:09:36 -0000 1.1
--- models.py 7 Aug 2003 03:28:56 -0000 1.2
***************
*** 2,6 ****
from twisted.web.woven import model
import time
!
class UserModel(model.MethodModel):
--- 2,6 ----
from twisted.web.woven import model
import time
! from messaging import parseDate
class UserModel(model.MethodModel):
***************
*** 9,13 ****
def getStore(self, request):
! path = "/".join(request.postpath)
if path:
return self.user.messages.openChildStores().addCallback(lambda stores: stores.get(path) or self.user.messages)
--- 9,14 ----
def getStore(self, request):
! path = "/".join(request.postpath).strip('/')
! print "PATH", path
if path:
return self.user.messages.openChildStores().addCallback(lambda stores: stores.get(path) or self.user.messages)
***************
*** 39,43 ****
# sort messageList by date
! messageList.sort(lambda a,b: cmp(a[1]['timestamp'], b[1]['timestamp']))
finished.count = 0
--- 40,47 ----
# sort messageList by date
! messageList.sort(lambda a,b: cmp(
! parseDate(a[1]['Date']),
! parseDate(b[1]['Date'])
! ))
finished.count = 0
***************
*** 48,56 ****
day = time.strptime(date, "%Y-%m-%d")[:3]
else:
! day = messageList[-1][1]['timestamp'][:3]
idsToFetch = []
for id, headers in messageList:
! if headers['timestamp'][:3] == day:
idsToFetch.append(id)
--- 52,62 ----
day = time.strptime(date, "%Y-%m-%d")[:3]
else:
! print messageList[-1][1]['Date']
! print parseDate(messageList[-1][1]['Date'])
! day = parseDate(messageList[-1][1]['Date'])[:3]
idsToFetch = []
for id, headers in messageList:
! if parseDate(headers['Date'])[:3] == day:
idsToFetch.append(id)
***************
*** 69,73 ****
finished.messages.append(message)
if len(finished.messages) == finished.count:
! finished.messages.sort(lambda a,b: cmp(b.timestamp, a.timestamp))
print "GOT ALL MESSAGES, CALLING BACK"
finished.callback(finished.messages)
--- 75,79 ----
finished.messages.append(message)
if len(finished.messages) == finished.count:
! finished.messages.sort(lambda a,b: cmp(b.getTimestamp(), a.getTimestamp()))
print "GOT ALL MESSAGES, CALLING BACK"
finished.callback(finished.messages)
***************
*** 93,98 ****
days = []
for id, headers in messageList.items():
! if headers['timestamp'][1] == month:
! days.append(headers['timestamp'][2])
print "CALLING BACK CAL DATES"
--- 99,106 ----
days = []
for id, headers in messageList.items():
! timestamp = parseDate(headers['Date'])
! print "PARSED DATE", timestamp
! if timestamp[1] == month:
! days.append(timestamp[2])
print "CALLING BACK CAL DATES"
|