Edgewall Software
Modify

Opened 6 months ago

Closed 6 months ago

Last modified 4 months ago

#11609 closed enhancement (fixed)

Add realm attribute to Model classes

Reported by: rjollos Owned by: rjollos
Priority: normal Milestone: 1.1.2
Component: general Version:
Severity: normal Keywords: model
Cc: jomae
Release Notes:
API Changes:

Added realm attribute to model classes: Attachment, Milestone, Repository, Changeset, Node, Ticket and WikiPage.

Description (last modified by rjollos)

The proposed change is a refactoring to add a realm attribute to Model and ResourceManager classes. In some cases, the attribute already exists: tags/trac-1.0.1/trac/wiki/model.py?marks=33#L30.

Previously discussed in th:comment:8:ticket:11706.

Attachments (0)

Change History (7)

comment:1 Changed 6 months ago by rjollos

  • Description modified (diff)
  • Summary changed from Add realm attribute to Model and ResourceManager classes to Add realm attribute to Model classes

Adding realm to IResourceManager classes doesn't seem to make sense given that they can be associated with multiple realms: tags/trac-1.0.1/trac/versioncontrol/api.py@:367-369#L364.

However the change for model classes probably makes sense. In Bloodhound there is a ModelBase class with a realm attribute, which is the first point that had me looking into this change.

Proposed changes in log:rjollos.git:t11609.

comment:2 Changed 6 months ago by jomae

  • Cc jomae added

Looks good to me. I think we could also add the same attribute to Attachment, Repository, Changeset and Node models. See [0a45ce96/jomae.git].

comment:3 follow-up: Changed 6 months ago by rjollos

  • Resolution set to fixed
  • Status changed from new to closed

Thanks for the additional changes. Component and Version in trac/ticket/model.py will probably have a realm attribute added when #1233 is implemented.

Should we have a model.py module in trac/versioncontrol for Repository, Changeset and Node models? That might give us a more consistent structuring of the modules.

Committed to trunk in [12776].

comment:4 in reply to: ↑ 3 ; follow-up: Changed 6 months ago by jomae

Replying to rjollos:

Should we have a model.py module in trac/versioncontrol for Repository, Changeset and Node models? That might give us a more consistent structuring of the modules.

Agreed. If these models are moved to model.py, I think we should add from trac.versioncontrol.model import Repository, Changeset, Node in api.py for backward compatibilities.

comment:5 in reply to: ↑ 4 Changed 6 months ago by rjollos

Replying to jomae:

Agreed. If these models are moved to model.py, I think we should add from trac.versioncontrol.model import Repository, Changeset, Node in api.py for backward compatibilities.

Thanks. I'll make the changes in #11610.

comment:6 Changed 6 months ago by rjollos

  • API Changes modified (diff)

comment:7 Changed 4 months ago by rjollos

  • Keywords model added

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed The owner will remain rjollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from rjollos to the specified user.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.