comparison doc/reference.txt @ 8517:0e712d67a783

doc: fix typo and error in check command change or -> for In check command replace: if user.organisation == issue.organisation: return True with return user.organisation == issue.organisation which returns a real False (not just a falsy None) and is more pythonic than if X: return True, just return X if False is a valid value.
author John Rouillard <rouilj@ieee.org>
date Wed, 28 Jan 2026 15:21:02 -0500
parents b99c40b40f18
children
comparison
equal deleted inserted replaced
8516:8c265e8bfc5a 8517:0e712d67a783
1818 1818
1819 Consider an example where we have a class structure where both the 1819 Consider an example where we have a class structure where both the
1820 ``issue`` class and the ``user`` class include a reference to an 1820 ``issue`` class and the ``user`` class include a reference to an
1821 ``organization`` class. Users are permitted to view only those 1821 ``organization`` class. Users are permitted to view only those
1822 issues that are associated with their respective organizations. A 1822 issues that are associated with their respective organizations. A
1823 check function or this could look like:: 1823 check function for this could look like::
1824 1824
1825 def view_issue(db, userid, itemid): 1825 def view_issue(db, userid, itemid):
1826 user = db.user.getnode(userid) 1826 user = db.user.getnode(userid)
1827 if not user.organisation: 1827 if not user.organisation:
1828 return False 1828 return False
1829 issue = db.issue.getnode(itemid) 1829 issue = db.issue.getnode(itemid)
1830 if user.organisation == issue.organisation: 1830 return user.organisation == issue.organisation
1831 return True 1831
1832 1832
1833 The corresponding ``filter`` function:: 1833 The corresponding ``filter`` function::
1834 1834
1835 def filter_issue(db, userid, klass): 1835 def filter_issue(db, userid, klass):
1836 user = db.user.getnode(userid) 1836 user = db.user.getnode(userid)

Roundup Issue Tracker: http://roundup-tracker.org/