1. Robot Mirror
  2. bugs.python.org

Commits

erik.forsberg  committed 9934b1d

Added keyword to schema and templates.

  • Participants
  • Parent commits cb46a99
  • Branches default

Comments (0)

Files changed (7)

File html/issue.index.html

View file
  • Ignore whitespace
    <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>
   </tr>
  <tal:block tal:repeat="i batch" condition=true>
   <tr tal:define="group python:[r[1] for r in request.group]"
        tal:content="python:i.creator.plain() or default">&nbsp;</td>
    <td tal:condition="request/show/assignee"
        tal:content="python:i.assignee.plain() or default">&nbsp;</td>
+   <td tal:condition="request/show/keywords"
+       tal:content="python:i.keywords.plain() or default">&nbsp;</td>
   </tr>
 
  </tal:block>

File html/issue.item.html

View file
  • Ignore whitespace
    <span tal:replace="structure python:db.priority.classhelp('id,name,description',label='Priority')" />:
  </th>
  <td tal:content="structure context/priority/menu">priority</td>
- <td></td><td></td>
+ <th i18n:translate="">Keywords:</th>
+ <td tal:content="structure context/keywords/menu">keywords</td>
+
+
 </tr>
 <tr tal:condition="context/is_edit_ok">
  <th><tal:block i18n:translate="">Change Note</tal:block>:</th>

File html/issue.search.html

View file
  • Ignore whitespace
   <td metal:use-macro="group_input"></td>
 </tr>
 
+<tr tal:define="name string:keywords;
+                db_klass string:keyword;
+                db_content string:name;">
+  <th i18n:translate="">Keyword:</th>
+  <td metal:use-macro="search_select_translated">
+    <option metal:fill-slot="extra_options" value="-1" i18n:translate=""
+            tal:attributes="selected python:value == '-1'">not set</option>
+  </td>
+  <td metal:use-macro="column_input"></td>
+  <td metal:use-macro="sort_input"></td>
+  <td metal:use-macro="group_input"></td>
+</tr>
+
 <tr tal:define="name string:priority;
                 db_klass string:priority;
                 db_content string:name;">

File html/keyword.index.html

View file
  • Ignore whitespace
+<tal:block metal:use-macro="templates/page/macros/icing">
+<title metal:fill-slot="head_title" >
+  <span tal:omit-tag="true" i18n:translate="" >List of keywords</span>
+  <span tal:condition="request/dispname"
+   tal:replace="python:' - %s '%request.dispname"
+  /> - <span tal:replace="config/TRACKER_NAME" />
+</title>
+<span metal:fill-slot="body_title" tal:omit-tag="true">
+  <span tal:omit-tag="true" i18n:translate="" >List of keywords</span>
+  <span tal:condition="request/dispname"
+   tal:replace="python:' - %s' % request.dispname" />
+</span>
+<tal:block metal:fill-slot="content">
+
+<p tal:condition="python:not (context.is_view_ok()
+ or request.user.hasRole('Anonymous'))" i18n:translate="">
+ You are not allowed to view this page.</p>
+
+<p tal:condition="python:not context.is_view_ok()
+ and request.user.hasRole('Anonymous')" i18n:translate="">
+ Please login with your username and password.</p>
+
+<table width="100%" tal:condition="context/is_view_ok" class="list">
+<tr>
+ <th i18n:translate="">Keyword</th>
+ <th i18n:translate="">Description</th>
+</tr>
+
+<tal:block repeat="keyword context/list">
+<tr tal:attributes="class python:['normal', 'alt'][repeat['keyword'].index%6/3]">
+ <td>
+  <a tal:attributes="href string:keyword${keyword/id}"
+     tal:content="keyword/name">keyword name</a>
+ </td>
+ <td tal:content="python:keyword.description.plain() or
+     default">&nbsp;</td>
+</tr>
+</tal:block>
+
+<tr tal:condition="context/is_edit_ok">
+   <td colspan="2"><a href="keyword?@template=item">New Keyword</a></td>
+</tr>
+</table>
+
+</tal:block>
+</tal:block>

File html/keyword.item.html

View file
  • Ignore whitespace
-<tal:block metal:use-macro="templates/page/macros/icing">
-<title metal:fill-slot="head_title" i18n:translate="">Keyword editing - <span
- i18n:name="tracker" tal:replace="config/TRACKER_NAME" /></title>
-<span metal:fill-slot="body_title" tal:omit-tag="python:1"
- i18n:translate="">Keyword editing</span>
+<tal:doc metal:use-macro="templates/page/macros/icing"
+define="edit_ok context/is_edit_ok"
+>
+<title metal:fill-slot="head_title">
+<tal:if condition="context/id" i18n:translate=""
+ >Keyword <span tal:replace="context/id" i18n:name="id"
+ />: <span tal:replace="context/name" i18n:name="title"
+ /> - <span tal:replace="config/TRACKER_NAME" i18n:name="tracker"
+/></tal:if>
+<tal:if condition="not:context/id" i18n:translate=""
+ >New Keyword - <span tal:replace="config/TRACKER_NAME" i18n:name="tracker"
+/></tal:if>
+</title>
+<metal:slot fill-slot="more-javascript">
+<script type="text/javascript" src="@@file/help_controls.js"></script>
+</metal:slot>
+<tal:block metal:fill-slot="body_title"
+  define="edit_ok context/is_edit_ok">
+ <span tal:condition="python: not (context.id or edit_ok)"
+  tal:omit-tag="python:1" i18n:translate="">New Keyword</span>
+ <span tal:condition="python: not context.id and edit_ok"
+  tal:omit-tag="python:1" i18n:translate="">New Keyword Editing</span>
+ <span tal:condition="python: context.id and not edit_ok"
+  tal:omit-tag="python:1" i18n:translate="">Keyword<tal:x
+  replace="context/id" i18n:name="id" /></span>
+ <span tal:condition="python: context.id and edit_ok"
+  tal:omit-tag="python:1" i18n:translate="">Keyword<tal:x
+  replace="context/id" i18n:name="id" /> Editing</span>
+</tal:block>
+
 <td class="content" metal:fill-slot="content">
 
-<table class="otherinfo" tal:define="keywords db/keyword/list"
-       tal:condition="keywords">
- <tr><th colspan="4" class="header" i18n:translate="">Existing Keywords</th></tr>
- <tr tal:repeat="start python:range(0, len(keywords), 4)">
-  <td width="25%" tal:define="batch python:utils.Batch(keywords, 4, start)"
-      tal:repeat="keyword batch">
-    <a tal:attributes="href string:keyword${keyword/id}"
-       tal:content="keyword/name">keyword here</a>
+<p tal:condition="python:not (context.is_view_ok()
+ or request.user.hasRole('Anonymous'))" i18n:translate="">
+ You are not allowed to view this page.</p>
+
+<p tal:condition="python:not context.is_view_ok()
+ and request.user.hasRole('Anonymous')" i18n:translate="">
+ Please login with your username and password.</p>
+
+<div tal:condition="context/is_view_ok">
+
+<form method="POST"
+      tal:define="required python:'name description'.split()"
+      enctype="multipart/form-data"
+      tal:attributes="action context/designator;">
+
+<table class="form">
+
+<tr>
+ <th class="required" i18n:translate="">Keyword:</th>
+ <td tal:content="structure
+ python:context.name.field(size=60)">title</td>
+</tr>
+
+<tr>
+ <th class="required" i18n:translate="">Description:</th>
+ <td tal:content="structure python:context.description.field(size=60)">description</td>
+
+</tr>
+
+ <tr tal:condition="context/is_edit_ok">
+  <td>
+   &nbsp;
+   <input type="hidden" name="@template" value="item">
+   <input type="hidden" name="@required" value="name,description"
+          tal:attributes="value python:','.join(required)">
+  </td>
+  <td><input type="submit" value="save" tal:replace="structure context/submit"><!--submit button here-->
+    <input type="reset">
   </td>
  </tr>
- <tr>
-  <td colspan="4" style="border-top: 1px solid gray" i18n:translate="">
-   To edit an existing keyword (for spelling or typing errors),
-   click on its entry above.
-  </td>
- </tr>
+
 </table>
-
-<p class="help" tal:condition="not:context/id" i18n:translate="">
- To create a new keyword, enter it below and click "Submit New Entry".
-</p>
-
-<form method="POST" onSubmit="return submit_once()"
-      enctype="multipart/form-data"
-      tal:attributes="action context/designator">
-
- <table class="form">
-  <tr>
-   <th i18n:translate="">Keyword</th>
-   <td tal:content="structure context/name/field">name</td>
-  </tr>
-
-  <tr>
-   <td>
-    &nbsp;
-    <input type="hidden" name="@required" value="name">
-    <input type="hidden" name="@template" value="item">
-   </td>
-   <td colspan=3 tal:content="structure context/submit">
-    submit button will go here
-   </td>
-  </tr>
- </table>
 </form>
+</div>
 </td>
-
-</tal:block>
+</tal:doc>

File html/page.html

View file
  • Ignore whitespace
    </li>
    <li tal:condition="python:request.user.hasPermission('Create', 'user')"><a href="user?@template=item" i18n:translate="">Add User</a>
    </li>
+   <li tal:condition="python:request.user.hasPermission('Edit',
+ 'keyword')"><a href="keyword" i18n:translate="">Edit Keywords</a>
+   </li>
    </ul>
      </li>
      <li class="">

File schema.py

View file
  • Ignore whitespace
                    order=Number())
 resolution.setkey('name')
 
+# Keyword
+keyword = Class(db, "keyword",
+                name=String(),
+                description=String())
+keyword.setkey("name")
+                
+
 # User-defined saved searches
 query = Class(db, "query",
               klass=String(),
                    assignee=Link('user'),
                    status=Link('status'),
                    resolution=Link('resolution'),
-                   superseder=Link('issue'))
+                   superseder=Link('issue'),
+                   keywords=Multilink("keyword"))
 
 #
 # TRACKER SECURITY SETTINGS
 # User permissions
 ##########################
 for cl in ('issue_type', 'severity', 'component',
-           'version', 'priority', 'status', 'resolution', 'issue', 'file', 'msg'):
+           'version', 'priority', 'status', 'resolution',
+           'issue', 'file', 'msg', 'keyword'):
     db.security.addPermissionToRole('User', 'View', cl)
 
 for cl in 'file', 'msg':
 # Developer permissions
 ##########################
 for cl in ('issue_type', 'severity', 'component',
-           'version', 'priority', 'status', 'resolution', 'issue', 'file', 'msg'):
+           'version', 'priority', 'status', 'resolution',
+           'issue', 'file', 'msg', 'keyword'):
     db.security.addPermissionToRole('Developer', 'View', cl)
 
-for cl in ('issue', 'file', 'msg'):
+for cl in ('issue', 'file', 'msg', 'keyword'):
     db.security.addPermissionToRole('Developer', 'Edit', cl)
     db.security.addPermissionToRole('Developer', 'Create', cl)