[Python-checkins] r64891 - in tracker/instances/board: config.ini.template detectors/autoassign.py detectors/changes_xml_writer.py detectors/cia.py detectors/no_texthtml.py detectors/patches.py detectors/severityauditor.py detectors/spambayes.py html/issue.index.html html/issue.item.html initial_data.py schema.py

martin.v.loewis python-checkins at python.org
Sat Jul 12 10:46:10 CEST 2008


Author: martin.v.loewis
Date: Sat Jul 12 10:46:09 2008
New Revision: 64891

Log:
Configure board tracker.


Removed:
   tracker/instances/board/detectors/autoassign.py
   tracker/instances/board/detectors/changes_xml_writer.py
   tracker/instances/board/detectors/cia.py
   tracker/instances/board/detectors/no_texthtml.py
   tracker/instances/board/detectors/patches.py
   tracker/instances/board/detectors/severityauditor.py
   tracker/instances/board/detectors/spambayes.py
Modified:
   tracker/instances/board/config.ini.template
   tracker/instances/board/html/issue.index.html
   tracker/instances/board/html/issue.item.html
   tracker/instances/board/initial_data.py
   tracker/instances/board/schema.py

Modified: tracker/instances/board/config.ini.template
==============================================================================
--- tracker/instances/board/config.ini.template	(original)
+++ tracker/instances/board/config.ini.template	Sat Jul 12 10:46:09 2008
@@ -115,7 +115,7 @@
 # Default: NO DEFAULT
 #web = NO DEFAULT
 #web = http://psf.upfronthosting.co.za/roundup/tracker/
-web = http://localhost:9999/python-dev/
+web = http://localhost:9999/board/
 
 # Email address that mail to roundup should go to.
 # Default: issue_tracker
@@ -160,7 +160,7 @@
 
 # Name of the database to use.
 # Default: roundup
-name = roundup
+name = roundup_board
 
 # Database server host.
 # Default: localhost

Deleted: tracker/instances/board/detectors/autoassign.py
==============================================================================
--- tracker/instances/board/detectors/autoassign.py	Sat Jul 12 10:46:09 2008
+++ (empty file)
@@ -1,28 +0,0 @@
-# Auditor to automatically assign issues to a user when
-# the component field gets set
-
-def autoassign(db, cl, nodeid, newvalues):
-    try:
-        components = newvalues['components']
-    except KeyError:
-        # Without components, nothing needs to be auto-assigned
-        return
-    if newvalues.has_key('assignee'):
-        # If there is an explicit assignee in the new values
-        # (even if it is None, in the case unassignment):
-        # do nothing
-        return
-    # If the issue is already assigned, do nothing
-    if nodeid and db.issue.get(nodeid, 'assignee'):
-        return
-    for component in components:
-        user = db.component.get(component, 'assign_to')
-        if user:
-            # If there would be multiple auto-assigned users
-            # arbitrarily pick the first one we find
-            newvalues['assignee'] = user
-            return
-
-def init(db):
-    db.issue.audit('create', autoassign)
-    db.issue.audit('set', autoassign)

Deleted: tracker/instances/board/detectors/changes_xml_writer.py
==============================================================================
--- tracker/instances/board/detectors/changes_xml_writer.py	Sat Jul 12 10:46:09 2008
+++ (empty file)
@@ -1,194 +0,0 @@
-#
-#  changes.xml writer detector.
-#
-# Copyright (c) 2007  Michal Kwiatkowski <constant.beta at gmail.com>
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# * Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-#
-# * Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-#
-# * Neither the name of the author nor the names of his contributors
-#   may be used to endorse or promote products derived from this software
-#   without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-"""changes.xml writer detector -- save each database change to an XML file.
-
-Root element is called `changes` and it has at most `ChangesXml.max_items`
-children, each called a `change`. Each `change` has the following attributes:
-
-:date:  date in RFC2822 format when the change was made
-:id:    unique identifier of this change (note: not an integer)
-:type:  type of this change (see below)
-
-A structure of a `change` depends on its `type`. Currently implemented
-change types and their formats are listed below.
-
-* type = `file-added`
-
-  Describes a new file attached to an existing issue. Child elements:
-
-  :file-id:   unique integer identifier of the file
-  :file-name: name of the uploaded file
-  :file-type: MIME type of the file content
-  :file-url:  permanent URL of the file
-  :issue-id:  unique integer identifier of an issue this file is attached to
-"""
-
-import os
-import urllib
-from xml.dom import minidom
-from xml.parsers.expat import ExpatError
-from time import gmtime, strftime
-
-# Relative to tracker home directory.
-FILENAME = os.path.join('%(TEMPLATES)s', 'recent-changes.xml')
-
-
-def tracker_url(db):
-    return str(db.config.options[('tracker', 'web')])
-
-def changes_xml_path(db):
-    return os.path.join(db.config.HOME, FILENAME % db.config.options)
-
-def rfc2822_date():
-    return strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime())
-
-class File(object):
-    def __init__(self, db, id, issue_id):
-        self.db = db
-        self.id = id
-        self.issue_id = issue_id
-
-        self.name = db.file.get(id, 'name')
-        self.type = db.file.get(id, 'type')
-        # Based on roundup.cgi.templating._HTMLItem.download_url().
-        self.download_url = tracker_url(self.db) +\
-            urllib.quote('%s%s/%s' % ('file', self.id, self.name))
-
-class ChangesXml(object):
-    # Maximum number of changes stored in a file.
-    max_items = 20
-
-    def __init__(self, filename):
-        self.filename = filename
-        self._read_document()
-        self.modified = False
-
-    def save(self):
-        if not self.modified:
-            return
-
-        self._trim_to_max_items()
-
-        fd = open(self.filename, 'w')
-        self.document.writexml(fd, encoding="UTF-8")
-        fd.close()
-
-    def add_file(self, file):
-        change = self._change("file%s-added-to-issue%s" % (file.id, file.issue_id),
-                              "file-added")
-
-        change.appendChild(self._element_with_text("file-id",   file.id))
-        change.appendChild(self._element_with_text("file-name", file.name))
-        change.appendChild(self._element_with_text("file-type", file.type))
-        change.appendChild(self._element_with_text("file-url",  file.download_url))
-        change.appendChild(self._element_with_text("issue-id",  file.issue_id))
-
-        self.root.appendChild(change)
-        self.modified = True
-
-    def add_files(self, files):
-        for file in files:
-            self.add_file(file)
-
-    def _change(self, id, type):
-        """Return new 'change' element of a given type.
-           <change id='id' date='now' type='type'></change>
-        """
-        change = self.document.createElement("change")
-        change.setAttribute("id",   id)
-        change.setAttribute("type", type)
-        change.setAttribute("date", rfc2822_date())
-        return change
-
-    def _element_with_text(self, name, value):
-        """Return new element with given name and text node as a value.
-           <name>value</name>
-        """
-        element = self.document.createElement(name)
-        text = self.document.createTextNode(str(value))
-        element.appendChild(text)
-        return element
-
-    def _trim_to_max_items(self):
-        """Remove changes exceeding self.max_items.
-        """
-        # Assumes that changes are stored sequentially from oldest to newest.
-        # Will do for now.
-        for change in self.root.getElementsByTagName("change")[0:-self.max_items]:
-            self.root.removeChild(change)
-
-    def _read_document(self):
-        try:
-            self.document = minidom.parse(self.filename)
-            self.root = self.document.firstChild
-        except IOError, e:
-            # File not found, create a new one then.
-            if e.errno != 2:
-                raise
-            self._create_new_document()
-        except ExpatError:
-            # File has been damaged, forget about it and create a new one.
-            self._create_new_document()
-
-    def _create_new_document(self):
-        self.document = minidom.Document()
-        self.root = self.document.createElement("changes")
-        self.document.appendChild(self.root)
-
-def get_new_files_ids(issue_now, issue_then):
-    """Return ids of files added between `now` and `then`.
-    """
-    files_now = set(issue_now['files'])
-    if issue_then:
-        files_then = set(issue_then['files'])
-    else:
-        files_then = set()
-    return map(int, files_now - files_then)
-
-def file_added_to_issue(db, cl, issue_id, olddata):
-    try:
-        changes   = ChangesXml(changes_xml_path(db))
-        issue     = db.issue.getnode(issue_id)
-        new_files = [ File(db, id, issue_id) for id in get_new_files_ids(issue, olddata) ]
-
-        changes.add_files(new_files)
-        changes.save()
-    except:
-        # We can't mess up with a database commit.
-        pass
-
-
-def init(db):
-    db.issue.react('create', file_added_to_issue)
-    db.issue.react('set',    file_added_to_issue)

Deleted: tracker/instances/board/detectors/cia.py
==============================================================================
--- tracker/instances/board/detectors/cia.py	Sat Jul 12 10:46:09 2008
+++ (empty file)
@@ -1,86 +0,0 @@
-# Reactor for sending changes to CIA.vc
-import xmlrpclib
-import cgi
-
-server = "http://CIA.vc"
-
-parameters = {
-    'name':'Roundup Reactor for CIA',
-    'revision': "$Revision$"[11:-2],
-    'project': 'Python',
-    'branch': 'roundup',
-    'urlprefix': 'http://bugs.python.org/issue',
-}
-
-max_content = 150
-
-TEMPLATE = """
-<message>
-<generator>
-  <name>Roundup Reactor for CIA</name>
-  <version>%(revision)s</version>
-</generator>
-<source>
-  <project>%(project)s</project>
-  <module>#%(nodeid)s</module>
-  <branch>%(branch)s</branch>
-</source>
-<body>
-  <commit>
-    <author>%(author)s</author>
-    <files><file>%(file)s</file></files>
-    <log>%(log)s</log>
-    <url>%(urlprefix)s%(nodeid)s</url>
-  </commit>
-</body>
-</message>
-"""
-
-
-def sendcia(db, cl, nodeid, oldvalues):
-    messages = set(cl.get(nodeid, 'messages'))
-    if oldvalues:
-        messages -= set(oldvalues.get('messages',()))
-    if not messages:
-        return
-    messages = list(messages)
-
-    if oldvalues:
-        oldstatus = oldvalues['status']
-    else:
-        oldstatus = None
-    newstatus = db.issue.get(nodeid, 'status')
-    if oldstatus != newstatus:
-        if oldvalues:
-            status = db.status.get(newstatus, 'name')
-        else:
-            status = 'new'
-        log = '[' + status + '] '
-    else:
-        log = ''
-    for msg in messages:
-        log += db.msg.get(msg, 'content')
-    if len(log) > max_content:
-        log = log[:max_content-4] + ' ...'
-    log = log.replace('\n', ' ')
-
-    params = parameters.copy()
-    params['file'] = cgi.escape(db.issue.get(nodeid, 'title'))
-    params['nodeid'] = nodeid
-    params['author'] = db.user.get(db.getuid(), 'username')
-    params['log'] = cgi.escape(log)
-
-    payload = TEMPLATE % params
-
-    try:
-        rpc = xmlrpclib.ServerProxy(server)
-        rpc.hub.deliver(payload)
-    except:
-        # Ignore any errors in sending the CIA;
-        # if the server is down, that's just bad luck
-        # XXX might want to do some logging here
-        pass
-
-def init(db):
-    db.issue.react('create', sendcia)
-    db.issue.react('set', sendcia)

Deleted: tracker/instances/board/detectors/no_texthtml.py
==============================================================================
--- tracker/instances/board/detectors/no_texthtml.py	Sat Jul 12 10:46:09 2008
+++ (empty file)
@@ -1,9 +0,0 @@
-
-def audit_html_files(db, cl, nodeid, newvalues):
-    if newvalues.has_key('type') and newvalues['type'] == 'text/html':
-        newvalues['type'] = 'text/plain'
-    
-
-def init(db):
-    db.file.audit('set', audit_html_files)
-    db.file.audit('create', audit_html_files)

Deleted: tracker/instances/board/detectors/patches.py
==============================================================================
--- tracker/instances/board/detectors/patches.py	Sat Jul 12 10:46:09 2008
+++ (empty file)
@@ -1,45 +0,0 @@
-# Auditor for patch files
-# Patches should be declared as text/plain (also .py files),
-# independent of what the browser says, and
-# the "patch" keyword should get set automatically.
-
-import posixpath
-
-patchtypes = ('.diff', '.patch')
-sourcetypes = ('.diff', '.patch', '.py')
-
-def ispatch(file, types):
-    return posixpath.splitext(file)[1] in types
-
-def patches_text_plain(db, cl, nodeid, newvalues):
-    if ispatch(newvalues['name'], sourcetypes):
-        newvalues['type'] = 'text/plain'
-
-def patches_keyword(db, cl, nodeid, newvalues):
-    # Check whether there are any new files
-    newfiles = set(newvalues.get('files',()))
-    if nodeid:
-        newfiles -= set(db.issue.get(nodeid, 'files'))
-    # Check whether any of these is a patch
-    newpatch = False
-    for fileid in newfiles:
-        if ispatch(db.file.get(fileid, 'name'), patchtypes):
-            newpatch = True
-            break
-    if newpatch:
-        # Add the patch keyword if its not already there
-        patchid = db.keyword.lookup("patch")
-        oldkeywords = []
-        if nodeid:
-            oldkeywords = db.issue.get(nodeid, 'keywords')
-            if patchid in oldkeywords:
-                # This is already marked as a patch
-                return
-        if not newvalues.has_key('keywords'):
-            newvalues['keywords'] = oldkeywords
-        newvalues['keywords'].append(patchid)
-
-def init(db):
-    db.file.audit('create', patches_text_plain)
-    db.issue.audit('create', patches_keyword)
-    db.issue.audit('set', patches_keyword)

Deleted: tracker/instances/board/detectors/severityauditor.py
==============================================================================
--- tracker/instances/board/detectors/severityauditor.py	Sat Jul 12 10:46:09 2008
+++ (empty file)
@@ -1,11 +0,0 @@
-
-def init_severity(db, cl, nodeid, newvalues):
-    """Make sure severity is set on new issues"""
-    if newvalues.has_key('severity') and newvalues['severity']:
-        return
-
-    normal = db.severity.lookup('normal')
-    newvalues['severity'] = normal
-
-def init(db):
-    db.issue.audit('create', init_severity)

Deleted: tracker/instances/board/detectors/spambayes.py
==============================================================================
--- tracker/instances/board/detectors/spambayes.py	Sat Jul 12 10:46:09 2008
+++ (empty file)
@@ -1 +0,0 @@
-link ../../spambayes_integration/detectors/spambayes.py
\ No newline at end of file

Modified: tracker/instances/board/html/issue.index.html
==============================================================================
--- tracker/instances/board/html/issue.index.html	(original)
+++ tracker/instances/board/html/issue.index.html	Sat Jul 12 10:46:09 2008
@@ -23,16 +23,13 @@
 <tal:block tal:define="batch request/batch" tal:condition="context/is_view_ok">
  <table class="list">
   <tr>
-   <th tal:condition="request/show/severity" i18n:translate="">Severity</th>
    <th tal:condition="request/show/id" i18n:translate="">ID</th>
    <th tal:condition="request/show/creation" i18n:translate="">Creation</th>
    <th tal:condition="request/show/activity" i18n:translate="">Activity</th>
    <th tal:condition="request/show/actor" i18n:translate="">Actor</th>
    <th tal:condition="request/show/title" i18n:translate="">Title</th>
    <th tal:condition="request/show/components"  i18n:translate="">Components</th>
-   <th tal:condition="request/show/versions" i18n:translate="">Versions</th>
    <th tal:condition="request/show/status"    i18n:translate="">Status</th>
-   <th tal:condition="request/show/resolution" i18n:translate="">Resolution</th>
    <th tal:condition="request/show/creator" i18n:translate="">Creator</th>
    <th tal:condition="request/show/assignee" i18n:translate="">Assigned&nbsp;To</th>
    <th tal:condition="request/show/keywords" i18n:translate="">Keywords</th>
@@ -50,8 +47,6 @@
   </tr>
 
   <tr tal:attributes="class python:['even','odd'][repeat['i'].even()]">
-   <td tal:condition="request/show/severity"
-       tal:content="python:i.severity.plain() or default">&nbsp;</td>
    <td tal:condition="request/show/id" tal:content="i/id">&nbsp;</td>
    <td class="date" tal:condition="request/show/creation"
        tal:content="i/creation/reldate">&nbsp;</td>
@@ -65,12 +60,8 @@
    </td>
    <td tal:condition="request/show/components"
        tal:content="python:i.components.plain() or default">&nbsp;</td>
-   <td tal:condition="request/show/versions"
-       tal:content="python:i.versions.plain() or default">&nbsp;</td>
    <td tal:condition="request/show/status"
        tal:content="python:i.status.plain() or default">&nbsp;</td>
-   <td tal:condition="request/show/resolution"
-       tal:content="python:i.resolution.plain() or default">&nbsp;</td>
    <td tal:condition="request/show/creator"
        tal:content="python:i.creator.plain() or default">&nbsp;</td>
    <td tal:condition="request/show/assignee"

Modified: tracker/instances/board/html/issue.item.html
==============================================================================
--- tracker/instances/board/html/issue.item.html	(original)
+++ tracker/instances/board/html/issue.item.html	Sat Jul 12 10:46:09 2008
@@ -73,10 +73,6 @@
    <span tal:replace="structure python:db.component.classhelp('id,name,description',label='Components')" />:
  </th>
  <td tal:content="structure context/components/menu">components</td>
- <th i18n:translate="">
-   <span tal:replace="structure python:db.version.classhelp('id,name,description',label='Versions')" />:
- </th>
- <td tal:content="structure context/versions/menu">versions</td>
 </tr>
 </table>
 </fieldset>
@@ -88,8 +84,6 @@
    <span tal:replace="structure python:db.status.classhelp('id,name,description',label='Status')" />:
  </th>
  <td tal:content="structure context/status/menu">status</td>
- <th i18n:translate="">Resolution:</th>
- <td tal:content="structure context/resolution/menu">resolution</td>
 </tr>
 
 <tr tal:condition="context/id">

Modified: tracker/instances/board/initial_data.py
==============================================================================
--- tracker/instances/board/initial_data.py	(original)
+++ tracker/instances/board/initial_data.py	Sat Jul 12 10:46:09 2008
@@ -5,51 +5,10 @@
 #
 
 issue_type = db.getclass('issue_type')
-issue_type.create(name='crash', order='1')
-issue_type.create(name='compile error', order='2')
-issue_type.create(name='resource usage', order='3')
-issue_type.create(name='security', order='4')
-issue_type.create(name='behavior', order='5')
-issue_type.create(name='rfe', order='6')
+issue_type.create(name='todo', order='1')
 
 component = db.getclass('component')
-component.create(name="Build", order="1")
-component.create(name="Demos and Tools", order="2")
-component.create(name="Distutils", order="3")
-component.create(name="Documentation", order="4")
-component.create(name="Extension Modules", order="5")
-component.create(name="IDLE", order="6")
-component.create(name="Installation", order="7")
-component.create(name="Interpreter Core", order="8")
-component.create(name="Library (Lib)", order="9")
-component.create(name="Macintosh", order="10")
-component.create(name="Regular Expressions", order="11")
-component.create(name="Tests", order="12")
-component.create(name="Tkinter", order="13")
-component.create(name="Unicode", order="14")
-component.create(name="Windows", order="15")
-component.create(name="XML", order="16")
-
-version = db.getclass('version')
-version.create(name='Python 2.6', order='1')
-version.create(name='Python 2.5', order='2')
-version.create(name='Python 2.4', order='3')
-version.create(name='Python 2.3', order='4')
-version.create(name='Python 2.2.3', order='5')
-version.create(name='Python 2.2.2', order='6')
-version.create(name='Python 2.2.1', order='7')
-version.create(name='Python 2.2', order='8')
-version.create(name='Python 2.1.2', order='9')
-version.create(name='Python 2.1.1', order='10')
-version.create(name='3rd party', order='11')
-
-
-severity = db.getclass('severity')
-severity.create(name='critical', order='1')
-severity.create(name='urgent', order='2')
-severity.create(name='major', order='3')
-severity.create(name='normal', order='4')
-severity.create(name='minor', order='5')
+component.create(name="Conference", order="1")
 
 priority = db.getclass('priority')
 priority.create(name='immediate', order='1')
@@ -63,22 +22,9 @@
 status.create(name='closed', order='2')
 status.create(name='pending', description='user feedback required', order='3')
 
-resolution = db.getclass('resolution')
-resolution.create(name='accepted', order='1')
-resolution.create(name='duplicate', order='2')
-resolution.create(name='fixed', order='3')
-resolution.create(name='invalid', order='4')
-resolution.create(name='later', order='5')
-resolution.create(name='out of date', order='6')
-resolution.create(name='postponed', order='7')
-resolution.create(name='rejected', order='8')
-resolution.create(name='remind', order='9')
-resolution.create(name='wont fix', order='10')
-resolution.create(name='works for me', order='11')
-
-keyword = db.getclass("keyword")
-keyword.create(name="py3k", description="Python 3000 bugs")
-keyword.create(name="patch", description="Contains patch")
+#keyword = db.getclass("keyword")
+#keyword.create(name="py3k", description="Python 3000 bugs")
+#keyword.create(name="patch", description="Contains patch")
 
 #
 # create the two default users

Modified: tracker/instances/board/schema.py
==============================================================================
--- tracker/instances/board/schema.py	(original)
+++ tracker/instances/board/schema.py	Sat Jul 12 10:46:09 2008
@@ -25,18 +25,18 @@
 component.setkey('name')
 
 # Version
-version = Class(db, 'version',
-                name=String(),
-                description=String(),
-                order=Number())
-version.setkey('name')
+#version = Class(db, 'version',
+#                name=String(),
+#                description=String(),
+#                order=Number())
+#version.setkey('name')
 
 # Severity
-severity = Class(db, 'severity',
-                 name=String(),
-                 description=String(),
-                 order=Number())
-severity.setkey('name')
+#severity = Class(db, 'severity',
+#                 name=String(),
+#                 description=String(),
+#                 order=Number())
+#severity.setkey('name')
 
 # Priority
 priority = Class(db, 'priority',
@@ -52,13 +52,6 @@
                order=Number())
 status.setkey("name")
 
-# Resolution
-resolution = Class(db, "resolution",
-                   name=String(),
-                   description=String(),
-                   order=Number())
-resolution.setkey('name')
-
 # Keyword
 keyword = Class(db, "keyword",
                 name=String(),
@@ -117,13 +110,13 @@
 issue = IssueClass(db, "issue",
                    type=Link('issue_type'),
                    components=Multilink('component'),
-                   versions=Multilink('version'),
-                   severity=Link('severity'),
+#                   versions=Multilink('version'),
+#                   severity=Link('severity'),
                    priority=Link('priority'),
                    dependencies=Multilink('issue'),
                    assignee=Link('user'),
                    status=Link('status'),
-                   resolution=Link('resolution'),
+#                   resolution=Link('resolution'),
                    superseder=Link('issue'),
                    keywords=Multilink("keyword"))
 
@@ -133,17 +126,14 @@
 # See the configuration and customisation document for information
 # about security setup.
 
-db.security.addRole(name='Developer', description='A developer')
+db.security.addRole(name='Board', description='A board member')
 db.security.addRole(name='Coordinator', description='A coordinator')
 
-db.security.addPermission(name="SB: May Classify")
-db.security.addPermission(name="SB: May Report Misclassified")
-
 #
 # REGULAR USERS
 #
 # Give the regular users access to the web and email interface
-for r in 'User', 'Developer', 'Coordinator':
+for r in 'User', 'Board', 'Coordinator':
     db.security.addPermissionToRole(r, 'Web Access')
     db.security.addPermissionToRole(r, 'Email Access')
 
@@ -151,11 +141,12 @@
 # User permissions
 ##########################
 
-for cl in ('issue_type', 'severity', 'component',
-           'version', 'priority', 'status', 'resolution',
+for cl in ('issue_type', 'component',
+#           'version', 'resolution', 'severity', 
+           'priority', 'status', 
            'issue', 'keyword'):
     db.security.addPermissionToRole('User', 'View', cl)
-    db.security.addPermissionToRole('Anonymous', 'View', cl)
+    #db.security.addPermissionToRole('Anonymous', 'View', cl)
 
 class may_view_spam:
     def __init__(self, klassname):
@@ -188,7 +179,7 @@
                                               'description',
                                               ))
 
-    db.security.addPermissionToRole('Anonymous', p)
+    #db.security.addPermissionToRole('Anonymous', p)
     db.security.addPermissionToRole('User', p)
 
     db.security.addPermissionToRole('User', 'Create', cl)
@@ -204,7 +195,7 @@
                                           properties=('content', 'summary'),
                                           check=may_view_spam(cl))
 
-    db.security.addPermissionToRole('Anonymous', spamcheck)
+    #db.security.addPermissionToRole('Anonymous', spamcheck)
 
 def may_edit_file(db, userid, itemid):
     return userid == db.file.get(itemid, "creator")
@@ -212,54 +203,51 @@
     description="User is allowed to remove their own files")
 db.security.addPermissionToRole('User', p)
 
-p = db.security.addPermission(name='Create', klass='issue',
-                              properties=('title', 'type',
-                                          'components', 'versions',
-                                          'severity',
-                                          'messages', 'files', 'nosy'),
-                              description='User can report and discuss issues')
-db.security.addPermissionToRole('User', p)
-
-p = db.security.addPermission(name='Edit', klass='issue',
-                              properties=('title', 'type',
-                                          'components', 'versions',
-                                          'severity',
-                                          'messages', 'files', 'nosy'),
-                              description='User can report and discuss issues')
-db.security.addPermissionToRole('User', p)
-
-db.security.addPermissionToRole('User', 'SB: May Report Misclassified')
-
+#p = db.security.addPermission(name='Create', klass='issue',
+#                              properties=('title', 'type',
+#                                          'components', 'versions',
+#                                          'severity',
+#                                          'messages', 'files', 'nosy'),
+#                              description='User can report and discuss issues')
+#db.security.addPermissionToRole('User', p)
+
+#p = db.security.addPermission(name='Edit', klass='issue',
+#                              properties=('title', 'type',
+#                                          'components', 'versions',
+#                                          'severity',
+#                                          'messages', 'files', 'nosy'),
+#                              description='User can report and discuss issues')
+#db.security.addPermissionToRole('User', p)
 
 
 ##########################
-# Developer permissions
+# Board permissions
 ##########################
-for cl in ('issue_type', 'severity', 'component',
-           'version', 'priority', 'status', 'resolution',
+for cl in ('issue_type', 'component',
+#           'severity', 'version', 'resolution',
+           'priority', 'status', 
            'issue', 'file', 'msg', 'keyword'):
-    db.security.addPermissionToRole('Developer', 'View', cl)
+    db.security.addPermissionToRole('Board', 'View', cl)
 
 for cl in ('issue', 'file', 'msg', 'keyword'):
-    db.security.addPermissionToRole('Developer', 'Edit', cl)
-    db.security.addPermissionToRole('Developer', 'Create', cl)
+    db.security.addPermissionToRole('Board', 'Edit', cl)
+    db.security.addPermissionToRole('Board', 'Create', cl)
 
 
 ##########################
 # Coordinator permissions
 ##########################
-for cl in ('issue_type', 'severity', 'component',
-           'version', 'priority', 'status', 'resolution', 'issue', 'file', 'msg'):
+for cl in ('issue_type', 'component',
+#          'severity', 'version', 'resolution', 
+           'priority', 'status', 'issue', 'file', 'msg'):
     db.security.addPermissionToRole('Coordinator', 'View', cl)
     db.security.addPermissionToRole('Coordinator', 'Edit', cl)
     db.security.addPermissionToRole('Coordinator', 'Create', cl)
 
-db.security.addPermissionToRole('Coordinator', 'SB: May Classify')
-
 # May users view other user information? Comment these lines out
 # if you don't want them to
 db.security.addPermissionToRole('User', 'View', 'user')
-db.security.addPermissionToRole('Developer', 'View', 'user')
+db.security.addPermissionToRole('Board', 'View', 'user')
 db.security.addPermissionToRole('Coordinator', 'View', 'user')
 
 # Allow Coordinator to edit any user, including their roles.
@@ -273,7 +261,7 @@
     return userid == itemid
 p = db.security.addPermission(name='View', klass='user', check=own_record,
     description="User is allowed to view their own user details")
-for r in 'User', 'Developer', 'Coordinator':
+for r in 'User', 'Board', 'Coordinator':
     db.security.addPermissionToRole(r, p)
 p = db.security.addPermission(name='Edit', klass='user', check=own_record,
     description="User is allowed to edit their own user details",
@@ -283,7 +271,7 @@
                 'alternate_addresses',
                 'queries',
                 'timezone')) # Note: 'roles' excluded - users should not be able to edit their own roles. 
-for r in 'User', 'Developer':
+for r in 'User', 'Board':
     db.security.addPermissionToRole(r, p)
 
 # Users should be able to edit and view their own queries. They should also
@@ -297,15 +285,15 @@
     return userid == db.query.get(itemid, 'creator')
 p = db.security.addPermission(name='View', klass='query', check=view_query,
     description="User is allowed to view their own and public queries")
-for r in 'User', 'Developer', 'Coordinator':
+for r in 'User', 'Board', 'Coordinator':
     db.security.addPermissionToRole(r, p)
 p = db.security.addPermission(name='Edit', klass='query', check=edit_query,
     description="User is allowed to edit their queries")
-for r in 'User', 'Developer', 'Coordinator':
+for r in 'User', 'Board', 'Coordinator':
     db.security.addPermissionToRole(r, p)
 p = db.security.addPermission(name='Create', klass='query',
     description="User is allowed to create queries")
-for r in 'User', 'Developer', 'Coordinator':
+for r in 'User', 'Board', 'Coordinator':
     db.security.addPermissionToRole(r, p)
 
 
@@ -327,15 +315,15 @@
 # Assign the appropriate permissions to the anonymous user's Anonymous
 # Role. Choices here are:
 # - Allow anonymous users to register
-db.security.addPermissionToRole('Anonymous', 'Create', 'user')
+#db.security.addPermissionToRole('Anonymous', 'Create', 'user')
 
 # Allow anonymous users access to view issues (and the related, linked
 # information).
 # Note permissions settings for file and msg above (due to spambayes
 # integration).
 
-for cl in 'issue', 'severity', 'status', 'resolution':
-    db.security.addPermissionToRole('Anonymous', 'View', cl)
+#for cl in 'issue', 'severity', 'status', 'resolution':
+#    db.security.addPermissionToRole('Anonymous', 'View', cl)
 
 # [OPTIONAL]
 # Allow anonymous users access to create or edit "issue" items (and the


More information about the Python-checkins mailing list