Merge lp:~milo/linaro-ci-dashboard/textfield-loop into lp:linaro-ci-dashboard

Proposed by Milo Casagrande
Status: Merged
Approved by: Stevan Radaković
Approved revision: 34
Merged at revision: 34
Proposed branch: lp:~milo/linaro-ci-dashboard/textfield-loop
Merge into: lp:linaro-ci-dashboard
Diff against target: 0 lines
To merge this branch: bzr merge lp:~milo/linaro-ci-dashboard/textfield-loop
Reviewer Review Type Date Requested Status
Stevan Radaković Approve
Review via email:

Description of the change

Here there is the implementation of a generic text-field loop and AndroidTextFieldLoop.

I added a new model inside 'frontend/models' called TextFieldLoop, that is the generic model inheriting from Loop. AndroidTextFieldLoop instead is a new sub-app, which inherits from TextFieldLoop.

In AndroidTextFieldLoop there is also initial support for the 'can_chain_with' static method.
WRT this last point, at the moment I added some other methods in order to achieve class instantiation starting from a string. They are not used for now, and are in for review.

What 'can_chain_with' returns is a list of tuples, tuples defined in the 'loop_reference' file inside 'frontend/models/'. Each tuple consists of: (VISIBLE_NAME, MODULE_PATH.CLASS). There is an additional class, always in 'frontend/models/' called LoopFactory, with a static method, that from a string returns the corresponding class (this is a class object, it is not the real object, that needs to be instantiated later). These are just ideas on how to possibly implement this. I do not really like the part about hardcoding the module path, but at the moment I couldn't find another solution.

To post a comment you must log in.
Revision history for this message
Stevan Radaković (stevanr) wrote :

Hmmm, before addressing other stuff I'd like to discuss your loop_reference logic.
I don't understand the purpose of it nor why would we need the paths to our models.
The only usage of the can_chain_with method is to (in the end) get all the loops which are 'chainable' to the specific loop.
If can_chain_with returns the class names only in a simple list (we can track 'all' our class names in settings or separate class like you already have, but this is not really needed), then in a method we talked about (i.e. get_all_chainable) we would just query all loops with that specific types:
def get_all_chainable(self):
  loops = Loop.objects.get(type=[self.get_child_object().can_chain_with()])

where get_all_chainable is part of the Loop model.
I may be missing something here but I rly don't see the need of having class paths.

review: Needs Information
33. By Milo Casagrande

Renamed method, removed path reference and display name.

Revision history for this message
Milo Casagrande (milo) wrote :

As per discussion on IRC, store only the class name in 'loop_reference', removed also the display name.

34. By Milo Casagrande

Removed loop_factory class.

35. By Milo Casagrande

Update loop_reference comments.

Revision history for this message
Stevan Radaković (stevanr) wrote :

Looks much better.
Approve +1

review: Approve
36. By Milo Casagrande

Added missing newlines.

37. By Milo Casagrande

Merged from trunk.

38. By Milo Casagrande

Fixed migrations file.

39. By Milo Casagrande

Excluded 'type' from android text loop.

Preview Diff



People subscribed via source and target branches