Mercurial > p > roundup > code
comparison roundup/cgi/templating.py @ 7936:a9b136565838
feat: issue1525113 - notation to filter by logged-in user
At long last (almost 18 years) this patch lands. It allows sharing of
queries that want to use the currently logged in user (i.e. I or me).
By replacing an id number for the user by '@current_user' in the query
you can share the query for "my issues" where 'my' is the logged in
user not the person who created the query.
Updated the templates to use this.
Updated upgrading.py for directions on using it.
RDBMS and anydbm both work. Also expressions using it (e.g. not
@current_user) work and are tested.
Test code done.
I am not sure what the change to templating.py does. I am following
the original patch and have built a test case to hit the if
clause. But the rest of the test doesn't actualy provide the props I
need. If I knew what that code was supposed to do there I would create
a real test.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Mon, 06 May 2024 00:49:43 -0400 |
| parents | 29a666d8a70d |
| children | b63fcfc2c984 |
comparison
equal
deleted
inserted
replaced
| 7935:f670446b5e50 | 7936:a9b136565838 |
|---|---|
| 562 except (TypeError, KeyError): | 562 except (TypeError, KeyError): |
| 563 pass | 563 pass |
| 564 else: | 564 else: |
| 565 l.append(item) | 565 l.append(item) |
| 566 continue | 566 continue |
| 567 | |
| 567 # if fail_ok, ignore lookup error | 568 # if fail_ok, ignore lookup error |
| 568 # otherwise entry must be existing object id rather than key value | 569 # otherwise entry must be existing object id rather than key value |
| 569 if fail_ok: | 570 if fail_ok: |
| 570 l.append(entry) | 571 l.append(entry) |
| 572 elif entry == '@current_user' and prop.classname == 'user': | |
| 573 # as a special case, '@current_user' means the currently | |
| 574 # logged-in user | |
| 575 l.append(entry) | |
| 576 | |
| 571 return l | 577 return l |
| 572 | 578 |
| 573 | 579 |
| 574 def lookupKeys(linkcl, key, ids, num_re=num_re): | 580 def lookupKeys(linkcl, key, ids, num_re=num_re): |
| 575 """ Look up the "key" values for "ids" list - though some may already | 581 """ Look up the "key" values for "ids" list - though some may already |
