diff --git a/roundup/cgi/client.py b/roundup/cgi/client.py
index aa6d0868116afcf98f91e4ff69b6c3e6c2ca297f..86c1c83a3af78ef7d1ce05f36e911933688c34a8 100644 (file)
--- a/roundup/cgi/client.py
+++ b/roundup/cgi/client.py
-# $Id: client.py,v 1.107 2003-03-18 00:24:35 richard Exp $
+# $Id: client.py,v 1.110 2003-03-26 03:35:00 richard Exp $
__doc__ = """
WWW request handler (also used in the stand-alone server).
# we don't want clients caching our dynamic pages
self.additional_headers['Cache-Control'] = 'no-cache'
self.additional_headers['Pragma'] = 'no-cache'
- self.additional_headers['Expires'] = 'Thu, 1 Jan 1970 00:00:00 GMT'
+
+ # expire this page 5 seconds from now
+ date = rfc822.formatdate(time.time() + 5)
+ self.additional_headers['Expires'] = date
# render the content
self.write(self.renderContext())
raise NotModified
# we just want to serve up the file named
- mt = mimetypes.guess_type(str(file))[0]
+ file = str(file)
+ mt = mimetypes.guess_type(file)[0]
if not mt:
- mt = 'text/plain'
+ if file.endswith('.css'):
+ mt = 'text/css'
+ else:
+ mt = 'text/plain'
self.additional_headers['Content-Type'] = mt
self.additional_headers['Last-Modifed'] = rfc822.formatdate(lmt)
self.write(open(filename, 'rb').read())
return 0
except smtplib.SMTPException, msg:
self.error_message.append("Error: couldn't send email: %s"%msg)
- return 0
+ return 0
return 1
def registerPermission(self, props):
message = _('You are now registered, welcome!')
# redirect to the user's page
- raise Redirect, '%suser%s?@ok_message=%s&@template=%s'%(self.base,
- self.userid, urllib.quote(message), urllib.quote(self.template))
+ raise Redirect, '%suser%s?@ok_message=%s'%(self.base,
+ self.userid, urllib.quote(message))
def passResetAction(self):
''' Handle password reset requests.
# pull the rego information out of the otk database
otk = self.form['otk'].value
uid = self.db.otks.get(otk, 'uid')
+ if uid is None:
+ self.error_message.append('Invalid One Time Key!')
+ return
# re-open the database as "admin"
if self.user != 'admin':
nodeid, values = values[0], values[1:]
found[nodeid] = 1
+ # see if the node exists
+ if cl.hasnode(nodeid):
+ exists = 1
+ else:
+ exists = 0
+
# confirm correct weight
if len(idlessprops) != len(values):
self.error_message.append(
# extract the new values
d = {}
for name, value in zip(idlessprops, values):
+ prop = cl.properties[name]
value = value.strip()
# only add the property if it has a value
if value:
# if it's a multilink, split it
- if isinstance(cl.properties[name], hyperdb.Multilink):
+ if isinstance(prop, hyperdb.Multilink):
value = value.split(':')
d[name] = value
+ elif exists:
+ # nuke the existing value
+ if isinstance(prop, hyperdb.Multilink):
+ d[name] = []
+ else:
+ d[name] = None
# perform the edit
- if cl.hasnode(nodeid):
+ if exists:
# edit existing
cl.set(nodeid, **d)
else:
else:
continue
else:
- if not self.form[key].value: continue
+ if not self.form[key].value:
+ continue
self.form.value.append(cgi.MiniFieldStorage('@filter', key))
# handle saving the query params