Trouble with new tracker designator?
Tom Ekberg <[email protected]>
| Newsgroups | gmane.comp.bug-tracking.roundup.user |
|---|---|
| Message-ID | <MWHPR08MB2941242ADD82F47F14E7FCAFCA7B0@MWHPR08MB2941.namprd08.prod.outlook.com> |
I created a new tracker and got the issue.index.html and issue.item.html pages to work properly. I'm having trouble with the issue.search.html page. It is at the point where I'm defining a property to search on. The HTML code looks like this:
<tr tal:define="name string:zippy2;
db_klass string:zippy2;
db_content string:name;">
<th i18n:translate="">Zippy2:</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 selected</option>
</td>
<td metal:use-macro="column_input"></td>
<td metal:use-macro="sort_input"></td>
<td metal:use-macro="group_input"></td>
</tr>
Note this is for a link called zippy2. The schema.py file contains these lines related to zippy2:
zippy2 = Class(db, "zippy2",
name=String(),
order=Number())
zippy2.setkey("name")
zippy2=Link("zippy2"),
The last line is in the list of issue properties (IssueClass). I looked at the roundup design document (http://roundup.sourceforge.net/docs/design.html#property-names-and-types) in the Property Names and Types section. All it says about property names is that they must start with a letter. I suspect that the real problem is with the class name that ends with a digit. I saw nothing in that document defining restrictions on class names.
If you like to read gory details, please read on. The suggested fix is at the end. If not, please tell me what you think about what I have said so far.
The error I'm getting is in the macro search_select_translated defined in page.html as:
<td metal:define-macro="search_select_translated">
<select tal:attributes="name name; id name"
tal:define="value python:request.form.getvalue(name)">
<option value="" i18n:translate="">don't care</option>
<metal:slot define-slot="extra_options" />
<option value="" i18n:translate="" disabled="disabled">------------</option>
<option tal:repeat="s python:db[db_klass].list()"
tal:attributes="value s/id; selected python:value == s.id"
tal:content="python:s[db_content]"
i18n:translate=""></option>
</select>
</td>
on the repeat python expression. There error is:
<class 'KeyError'>: 'There is no class called "zippy"'
I did several searches (grep) in ,\my new tracker code looking for zippy. The lines that were found all had zippy2.
I suggest 2 fixes (sorry for the pun):
1. Define a section in the design document referenced above that states restrictions on class names, something like:
Class names must start with a letter and cannot end with a digit.
2. Change the constructor (__init__) method for hyperdb.Class (roundup/hyperdb.py line 901). Above that line is a check for reserved property names. Just above line 901 I suggest a check for a valid class name. Something like:
if not classname[0].isalpha() or classname[-1].isdigit():
raise ValueError('Class name %s is not valid. It must start with a letter and not end with a digit.' % (classname,))
The code reference is for roundup 1.6. The position in the code for roundup 2.0 may be different.
Tom Ekberg
Senior Computer Specialist,
Department of Laboratory Medicine and Pathology
4th Floor, Pat Steel Building, currently WFH
Home: (253) 561-2509
Email: [email protected]
_______________________________________________
Roundup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/roundup-users