DistroReleaseQueue.status could use the immutable flag

Bug #29663 reported by Christian Reis on 2006-01-25
Affects Status Importance Assigned to Milestone
Launchpad itself

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) on 2006-01-31
Changed in launchpad:
status: Unconfirmed → Confirmed
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".

Celso Providelo (cprov) wrote :

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

Changed in launchpad:
assignee: nobody → cprov

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

Curtis Hovey (sinzui) on 2010-06-01
Changed in soyuz:
assignee: Celso Providelo (cprov) → nobody
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  Edit
Everyone can see this information.

Other bug subscribers