Opened 11 years ago
Closed 8 years ago
#11706 closed task (fixed)
Code review
Reported by: | Steffen Hoffmann | Owned by: | |
---|---|---|---|
Priority: | high | Component: | DiscussionPlugin |
Severity: | normal | Keywords: | |
Cc: | Ryan J Ollos | Trac Release: | 0.11 |
Description
As recent development has been tracked in #6783, but going totally out-of-scope now, this ticket is meant to collect references and additional comment regarding this ongoing effort for tracdiscussion-0.9
.
Attachments (0)
Change History (38)
comment:1 Changed 11 years ago by
comment:8 Changed 11 years ago by
In [13916]: extracting the discussion
string to the realm
attribute is a good idea. All IResourceManager
and model classes in the Trac core should follow this pattern. Only a few do, such as the WikiPage
model: t:browser:/tags/trac-1.0.1/trac/wiki/model.py?marks=33#L30, but even in that case you can see instances where self.realm
isn't used to construct Resource
objects: t:browser:/tags/trac-1.0.1/trac/wiki/model.py?marks=43#L30. I started working on fixing this issue in the Trac core a few weeks back but never got around to finishing. Maybe I will find time to pick that up again this weekend.
comment:9 follow-up: 11 Changed 11 years ago by
forum_cols
was added as an attribute of the DiscussionDb
class, but the _get_forum
method which references the forum_cols
attribute via the call self.forum_cols
was moved to DiscussionApi
. It looks like that might result in an AttributeError
.
comment:11 Changed 11 years ago by
Replying to rjollos:
forum_cols
was added as an attribute of theDiscussionDb
class, but the_get_forum
method which references theforum_cols
attribute via the callself.forum_cols
was moved toDiscussionApi
. It looks like that might result in anAttributeError
.
I've been uneasy about this too, however the class inheritance of DiscussionDb
blends all attributes nicely to DiscussionApi
, so I just did the same for other column name tuples as well.
comment:12 follow-up: 13 Changed 11 years ago by
I see. I didn't see that the base class was DiscussionDb
, in which case I don't see any problem with it.
comment:13 Changed 11 years ago by
Replying to rjollos:
I see. I didn't see that the base class was
DiscussionDb
, in which case I don't see any problem with it.
Thanks for code-review anyway. Being a bit suspicious doesn't hurt.
comment:14 follow-up: 15 Changed 11 years ago by
comment:15 Changed 11 years ago by
Replying to hasienda:
Replying to rjollos:
In [13916]: extracting the
discussion
string to therealm
attribute is a good idea.Interesting. While I did this change without knowing that pattern from other resource managers, mainly for reducing string repetitions, I see the point in making it a common class attribute.
I went ahead and made a ticket: t:#11609.
comment:19 follow-up: 20 Changed 11 years ago by
Could you use context.req.perm.require('DISCUSSION_VIEW')
in [13921]?: trac:browser:/tags/trac-0.11/trac/perm.py?marks=543#L543.
comment:20 Changed 11 years ago by
comment:22 Changed 11 years ago by
In [13923]:
DiscussionPlugin: Do not insert unescaped values into SQL query string.
This issue in model._get_items()
went through on first review for [13919].
Luckily seeing the same thing done right in get_topics
pointed it out.
In a similar notion unregistered users are retrieved by set difference instead
of iteration over topic['subscribers']
in _prepare_topic()
too.
comment:36 Changed 8 years ago by
Going forward only major fixes will be applied to the 1.0 branch. Code review and improvements will continue in #12971.
comment:37 Changed 8 years ago by
Owner: | Steffen Hoffmann deleted |
---|
comment:38 Changed 8 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
In 13890: