Update of /cvs/fresco/web/hosts/issues/detectors
In directory purcel:/tmp/cvs-serv11182
Modified Files:
sanitycheck.py
Log Message:
* fix some typos
* coding style issues
Index: sanitycheck.py
===================================================================
RCS file: /cvs/fresco/web/hosts/issues/detectors/sanitycheck.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- sanitycheck.py 16 Sep 2003 18:14:56 -0000 1.2
+++ sanitycheck.py 7 Oct 2003 00:16:41 -0000 1.3
@@ -5,24 +5,31 @@
#
def check_bug_permissions(db, cl, newvalues):
- ''' Check wether the user tried to change something he shouldn't have.
- '''
+ """Check wether the user tried to change something he shouldn't have."""
if not db.security.hasPermission('Process', db.getuid(), cl.classname):
- if newvalues.has_key('assignedto') or newvalues.has_key('bug_type') or
newvalues.has_key('severity') or newvalues.has_key('topics') or
newvalues.has_key('status') or newvalues.has_key('resolution') or
newvalues.has_key('dependson') or newvalues.has_key('superseeder'):
+ if newvalues.has_key('assignedto')
+ or newvalues.has_key('bug_type')
+ or newvalues.has_key('severity')
+ or newvalues.has_key('topics')
+ or newvalues.has_key('status')
+ or newvalues.has_key('resolution')
+ or newvalues.has_key('dependson')
+ or newvalues.has_key('superseder'):
raise ValueError, "You don't have permission to edit one of the
selected fields."
def check_task_permissions(db, cl, newvalues):
- ''' Check wether the user tried to change something he shouldn't have.
- '''
+ """Check wether the user tried to change something he shouldn't have."""
# Only developers may edit tasks and they may edit any field.
return
def check_milestone_permissions(db, cl, newvalues):
- ''' Check wether the user tried to change something he shouldn't have.
- '''
+ """Check wether the user tried to change something he shouldn't have."""
if not db.security.hasPermission('Process', db.getuid(), cl.classname):
- if newvalues.has_key('bugs') or newvalues.has_key('tasks') or
newvalues.has_key('status') or newvalues.has_key('release_date'):
+ if newvalues.has_key('bugs')
+ or newvalues.has_key('tasks')
+ or newvalues.has_key('status')
+ or newvalues.has_key('release_date'):
raise ValueError, "You don't have permission to edit one of the
selected fields."
#
@@ -30,8 +37,7 @@
#
def set_bug(db, cl, nodeid, newvalues):
- ''' Ren sanitychecks on bugs
- '''
+ """Run sanitychecks on bugs."""
check_bug_permissions(db, cl, newvalues)
# Check resolution and related values:
@@ -42,8 +48,8 @@
raise ValueError, "Status has to be closed when providing a
resolution."
if newvalues['resolution'] == db.resolution.lookup('duplicate'):
- if not newvalues.has_key('superseeder'):
- raise ValueError, "Please provide a superseeder when setting
resolution to duplicate"
+ if not newvalues.has_key('superseder'):
+ raise ValueError, "Please provide a superseder when setting
resolution to duplicate"
if newvalues['resolution'] == db.resolution.lookup('invalid'):
if not newvalues.has_key('messages'):
@@ -51,12 +57,14 @@
# Check status and related values:
if newvalues.has_key('status'):
- if newvalues['status'] == db.status.lookup('open') and not
newvalues.has_key('assignedto'):
+ if newvalues['status'] == db.status.lookup('open')
+ and not newvalues.has_key('assignedto'):
raise ValueError, "You need to provide an assignee when setting the
status to open or closed."
if newvalues['status'] == db.status.lookup('closed'):
# Do we have a assignedto?
- if not newvalues.has_key('assignedto') and not cl.get(nodeid,
'assignedto'):
+ if not newvalues.has_key('assignedto')
+ and not cl.get(nodeid, 'assignedto'):
raise ValueError, "You need to provide an assignee when setting
the status to open or closed."
# Do we have a resolution?
@@ -69,15 +77,15 @@
raise ValueError, "The assignee is not a developer."
if newvalues.has_key('status'):
- if newvalues['status'] != db.status.lookup('open') and
newvalues['status'] != db.status.lookup('closed'):
+ if newvalues['status'] != db.status.lookup('open')
+ and newvalues['status'] != db.status.lookup('closed'):
raise ValueError, "When assigning someone to a bug the status
must be open or closed."
else:
newvalues['status'] = db.status.lookup('open')
def set_task(db, cl, nodeid, newvalues):
- ''' Ren sanitychecks on tasks
- '''
+ """Run sanitychecks on tasks."""
check_task_permissions(db, cl, newvalues)
# Check result and related values:
@@ -102,8 +110,7 @@
raise ValueError, "You must provide a result when setting
status to closed."
def set_milestone(db, cl, nodeid, newvalues):
- ''' Run sanitychecks on milestones
- '''
+ """Run sanitychecks on milestones."""
check_milestone_permissions(db, cl, newvalues)
@@ -112,8 +119,7 @@
#
def init_bug(db, cl, nodeid, newvalues):
- ''' initialize the unselected attributes of a new bug
- '''
+ """Initialize the unselected attributes of a new bug."""
check_bug_permissions(db, cl, newvalues)
if not newvalues.has_key('status'):
@@ -124,8 +130,7 @@
newvalues['priority'] = db.priority.lookup('normal')
def init_task(db, cl, nodeid, newvalues):
- ''' initialize the unselected attributes of a new task
- '''
+ """Initialize the unselected attributes of a new task."""
check_task_permissions(db, cl, newvalues)
if not newvalues.has_key('status'):
@@ -134,8 +139,7 @@
newvalues['priority'] = db.priority.lookup('normal')
def init_milestone(db, cl, nodeid, newvalues):
- ''' initialize the unselected attributes of a new milestone
- '''
+ """Initialize the unselected attributes of a new milestone."""
check_milestone_permissions(db, cl, newvalues)
if not newvalues.has_key('status'):
|