Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#984 closed enhancement (fixed)

ActivityIntermediator bits

Reported by: Elrond Owned by:
Priority: minor Milestone: 0.8.0
Component: programming Keywords:
Cc: Parent Tickets:


While looking at ActivityIntermediator, I noticed some bits.

The .set method could probably be rewritten a bit:

# We need to flush so that is populated
self.type = key

# First set self as activity
obj.activity =

And instead of checking values in .save use a validator.

def validate_type(self, key, value):
    assert value in self.TYPES
    return value

Change History (4)

comment:1 by Jessica Tallon, 10 years ago

Status: newreview

I've made the changes you've said above and also added some unit tests around the getters and setters for Activity/ActivityIntermediator. The commit is af53fa4.

Let me know when you've checked that there is nothing else so I can merge this.

comment:2 by Elrond, 10 years ago

That looks very good.

Little picky:

-from mediagoblin.db.base import Base, DictReadAttrProxy
+from mediagoblin.db.base import Base, DictReadAttrProxy, Session

Is this needed, now that we have commit=False?

-        # We need to save so that is populated

I like this comment, because it explains, why the .save() the save and commit=False is needed.

That's it.

comment:3 by Jessica Tallon, 10 years ago

Resolution: fixed
Status: reviewclosed

I have removed the unneeded Session import and reintroduced a comment to explain why I'm doing a This has been merged and pushed to master, the commit is 44c53d3.

comment:4 by Elrond, 10 years ago

Milestone: 0.8.0
Note: See TracTickets for help on using tickets.