read-only pages do not raise a TracError when there are insufficient privileges. In the case of an unprivileged user, they will see a grayed out form for readonly pages, but an error for normal pages.
One of the following changes should make it consistent. We opted for simply removing the TracError because it seems more graceful to show the grayed out form rather than an error.
From:
if page.readonly:
if 'WIKI_ADMIN' in req.perm(resource):
cancomment = True
elif 'WIKI_MODIFY' in req.perm(resource):
cancomment = True
elif appendonly and 'WIKI_VIEW' in req.perm(resource):
cancomment = True
else:
raise TracError('Error: Insufficient privileges to AddComment')
To:
if page.readonly:
if 'WIKI_ADMIN' in req.perm(resource):
cancomment = True
elif 'WIKI_MODIFY' in req.perm(resource):
cancomment = True
elif appendonly and 'WIKI_VIEW' in req.perm(resource):
cancomment = True
Or:
if page.readonly:
if 'WIKI_ADMIN' in req.perm(resource):
cancomment = True
else:
raise TracError('Error: Insufficient privileges to AddComment')
elif 'WIKI_MODIFY' in req.perm(resource):
cancomment = True
elif appendonly and 'WIKI_VIEW' in req.perm(resource):
cancomment = True
else:
raise TracError('Error: Insufficient privileges to AddComment')