Modify ↓
#3229 closed defect (fixed)
Cannot create posts without BLOG_ADMIN permission
Reported by: | Ingmar Heinrich | Owned by: | osimons |
---|---|---|---|
Priority: | high | Component: | FullBlogPlugin |
Severity: | critical | Keywords: | |
Cc: | Alec Thomas | Trac Release: | 0.11 |
Description
If a user has all BLOG_* permissions except BLOG_ADMIN, an exception is raised while creating a post:
File "/usr/lib/python2.4/site-packages/Trac-0.11dev_r7219-py2.4.egg/trac/web/main.py", line 423, in _dispatch_request dispatcher.dispatch(req) File "/usr/lib/python2.4/site-packages/Trac-0.11dev_r7219-py2.4.egg/trac/web/main.py", line 197, in dispatch resp = chosen_handler.process_request(req) File "/usr/lib/python2.4/site-packages/TracFullBlogPlugin-0.1-py2.4.egg/tracfullblog/web_ui.py", line 236, in process_request warnings.extend(blog_core.create_post( File "/usr/lib/python2.4/site-packages/TracFullBlogPlugin-0.1-py2.4.egg/tracfullblog/core.py", line 206, in create_post warnings.extend(manipulator.validate_blog_post( File "/usr/lib/python2.4/site-packages/TracFullBlogPlugin-0.1-py2.4.egg/tracfullblog/spamfilter.py", line 41, in validate_blog_post changes = [(to_unicode(last_post_fields.get(k, '')), NameError: global name 'k' is not defined
Severity is set to critical / priority to high since normal operation is impossible.
Attachments (0)
Change History (4)
comment:1 Changed 17 years ago by
Cc: | Alec Thomas added; anonymous removed |
---|
comment:2 Changed 17 years ago by
I suppose the spamfilter plugin should only receive actual changes between versions (again, I've never used it). Same code with 'if' test and somewhat easier to read source:
-
0.11/tracfullblog/spamfilter.py
38 38 last_post_fields = {} 39 39 40 40 field_names = set(fields).union(last_post_fields) 41 changes = [(to_unicode(last_post_fields.get(k, '')), 42 to_unicode(fields.get(k, '')))] 41 changes = [] 42 for field in field_names: 43 old = to_unicode(last_post_fields.get(field, '')) 44 new = to_unicode(fields.get(field, '')) 45 if old != new: 46 changes.append((old, new)) 43 47 author = fields.get('author', '') 44 48 FilterSystem(self.env).test(req, author, changes) 45 49 return []
Does it work better?
comment:4 Changed 17 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
I got no feedback on this so I went ahead and committed this last change anyway ([3907]). It is still untested, but can't possibly be more wrong than the code it replaces.
Please reopen if the problem persists.
Note: See
TracTickets for help on using
tickets.
Oh. That code does not look right. I made the spamfilter plugin for the future usage of the blog plugin here at Trac-Hacks, but don't actually use it myself so I can't test it.
Anyway, it does look wrong. Not quite knowing what the spamfilter expects, I would anyway hope this patch makes it work better for you:
0.11/tracfullblog/spamfilter.py
k, '')),k, '')))]Could you apply the changes and report back?