DistroReleaseQueue.status could use the immutable flag

Bug #29663 reported by Christian Reis
2
Affects Status Importance Assigned to Milestone
Launchpad itself
Triaged
Low
Unassigned

Bug Description

As per Salgado/Spiv's review on 2006-01-20 we should use the immutable=True flag on the status attribute, instead of the rather awkward _set_status() method we're using.

Dafydd Harries (daf)
Changed in launchpad:
status: Unconfirmed → Confirmed
Revision history for this message
Celso Providelo (cprov) wrote :

Salgado also suggested:

> This seems a bit evil to me. Have you checked with Andrew if there isn't a
> better way of doing this? Maybe having the DB column as a private attribute
> (not declared in the interface) and then providing a read-only property that
> only reads this private attribute. This way you won't need this _set_status()
> method and all the set_foo() methods could simply do "self._status = foo".

Revision history for this message
Celso Providelo (cprov) wrote :

I'll implment what fits better, just after catch up the previous review comments

Changed in launchpad:
assignee: nobody → cprov
Revision history for this message
Celso Providelo (cprov) wrote : Fix following salgado's suggestion

Not sure if it produces a better behaviour for this class, since selectBy() gets really broken by this change.

Curtis Hovey (sinzui)
Changed in soyuz:
assignee: Celso Providelo (cprov) → nobody
Revision history for this message
Julian Edwards (julian-edwards) wrote :

The way this sort of problem is fixed now is to use storm_validator on the model's property declaration.

e.g. from IArchive:

{{{
    name = StringCol(
        dbName='name', notNull=True, storm_validator=_validate_archive_name)
}}}

_validate_archive_name() is a method that does this:

{{{
    def _validate_archive_name(self, attr, value):
        if not self._SO_creating:
            assert self.is_copy, "Only COPY archives can be renamed."
        assert valid_name(value), "Invalid name given to unproxied object."
        return value
}}}

tags: added: tech-debt
tags: added: trivial
Changed in launchpad:
importance: Medium → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.