Skip to content

Commit 20f9616

Browse files
author
Richard Jones
committed
fixes
1 parent 49dd16e commit 20f9616

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

roundup/cgi/actions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#$Id: actions.py,v 1.40.2.5 2005-02-15 00:22:24 richard Exp $
1+
#$Id: actions.py,v 1.40.2.6 2005-02-15 23:42:36 richard Exp $
22

3-
import re, cgi, StringIO, urllib, Cookie, time, random
3+
import re, cgi, StringIO, urllib, Cookie, time, random, csv
44

5-
from roundup import hyperdb, token, date, password, csv
5+
from roundup import hyperdb, token, date, password
66
from roundup.i18n import _
77
import roundup.exceptions
88
from roundup.cgi import exceptions, templating
@@ -507,7 +507,7 @@ def lastNodeActivity(self):
507507
def detectCollision(self, user_activity, node_activity):
508508
'''Check for a collision and return the list of props we edited
509509
that conflict.'''
510-
if user_activity < node_activity:
510+
if user_activity and user_activity < node_activity:
511511
props, links = self.client.parsePropsFromForm()
512512
key = (self.classname, self.nodeid)
513513
# we really only collide for direct prop edit conflicts

roundup/cgi/templating.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919

2020
from __future__ import nested_scopes
2121

22-
import sys, cgi, urllib, os, re, os.path, time, errno, mimetypes
22+
import sys, cgi, urllib, os, re, os.path, time, errno, mimetypes, csv
2323

24-
from roundup import hyperdb, date, csv, support
24+
from roundup import hyperdb, date, support
2525
from roundup import i18n
2626
from roundup.i18n import _
2727

roundup/mailgw.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class node. Any parts of other types are each stored in separate files
7272
an exception, the original message is bounced back to the sender with the
7373
explanatory message given in the exception.
7474
75-
$Id: mailgw.py,v 1.159.2.3 2005-02-14 05:55:20 richard Exp $
75+
$Id: mailgw.py,v 1.159.2.4 2005-02-15 23:42:30 richard Exp $
7676
"""
7777
__docformat__ = 'restructuredtext'
7878

@@ -319,7 +319,7 @@ def __init__(self, instance, db, arguments=()):
319319
self.default_class = value.strip()
320320

321321
self.mailer = Mailer(instance.config)
322-
self.logger = getLogger('mailgw')
322+
self.logger = logging.getLogger('mailgw')
323323

324324
# should we trap exceptions (normal usage) or pass them through
325325
# (for testing)

test/test_actions.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,14 @@ def get(nodeid, propname):
168168
self.assertEqual(self.action.lastNodeActivity(), self.now)
169169

170170
def testCollision(self):
171-
self.failUnless(self.action.detectCollision(
172-
self.now, self.now + Interval("1d")))
173-
self.failIf(self.action.detectCollision(
174-
self.now, self.now - Interval("1d")))
171+
# fake up an actual change
172+
self.action.classname = 'test'
173+
self.action.nodeid = '1'
174+
self.client.parsePropsFromForm = lambda: ({('test','1'):{1:1}}, [])
175+
self.failUnless(self.action.detectCollision(self.now,
176+
self.now + Interval("1d")))
177+
self.failIf(self.action.detectCollision(self.now,
178+
self.now - Interval("1d")))
175179
self.failIf(self.action.detectCollision(None, self.now))
176180

177181
class LoginTestCase(ActionTestCase):

0 commit comments

Comments
 (0)