Roundup Tracker - Issues

Message1499

Author marlonvdb
Recipients
Date 2004-10-20.09:45:58
Message-id
In-reply-to
Logged In: YES 
user_id=1080231

I whish I could say otherwise, but I'm afraid that my patch
gives other (more serious) problems.

When accessing a search url like:
issue?@columns=id,type,title,assignedto,status&@sort=-id&@group=product&@filter=status&@pagesize=50&@startwith=0&status=-1,1,2,3,4,7,9,10&@template=index
an templating error does occur with the message:
    exceptions.IndexError: no such status node -1,1,2,3,4,7,9,10
    1. In python expression "i.status.plain() or default"
    2. While evaluating the  expression on line 197
    3. A problem occurred in your template "issue.index.html".

The reason is, that the url contains a *status* property.
That one will be present in the self._client.form dictionary
and so the patch will use that one on the index page. The
result is the error.

I came up with a possible solution, although I'm not really
proud of it because I'm relying on the assumption that
properties in URL's are only used in combination with the
'@filter' or ':filter' definition. If others have used
properties in there URL for other home made causes, then
this patch will break there home made feature :-(

In the *origional* cgi/templating.py on line 641 (for 0.7.8)
where it says:
            value = self._klass.get(self._nodeid, item, None)
Replace that line with:
            form = self._client.form
            # check if the value comes from the form
            if form.has_key(item):
                # need to check first if it is needed for
the filter
                filter = None
                for name in [':filter', '@filter']:
                    if form.has_key(name):
                        filter = form[name].value.strip() or
None
                        if filter:
                            break
                
                # if not for filter
                if not filter or not item in filter.split(','):
                    if isinstance(prop, hyperdb.Multilink):
                        value = lookupIds(self._db, prop,
                            handleListCGIValue(form[item]),
fail_ok=1)
                    elif isinstance(prop, hyperdb.Link):
                        value = form[item].value.strip()
                        if value:
                            value = lookupIds(self._db,
prop, [value],
                                fail_ok=1)[0]
                        else:
                            value = None
                    else:
                        value = form[item].value.strip() or None
                else:
                    # form value is meant for the filter,
take value from database
                    value = self._klass.get(self._nodeid,
item, None)
            else:
                # not in form, take value from database
                value = self._klass.get(self._nodeid, item,
None)

Regards,
Marlon
History
Date User Action Args
2009-02-03 14:20:59adminlinkissue1049799 messages
2009-02-03 14:20:59admincreate