You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't really like the pipeline cycle as a basic clean cycle because most of the time it requires some sort of differentiation per Item leaf class.
My suggestion is to create something similar as django's forms.Form clean loop. Which does something similar like my usual work-around, e.g.:
class ExtendedItem(Item):
def _process(self):
# Runs every '_process_FIELD_NAME' before being reached.
[getattr(self, func)() for func in dir(self) if func.split('_')[-1] in self.fields and callable(getattr(self, func))]
Now in my class definitions I can do something like (normally extended with optional arguments):
class Necklace(ExtendedItem):
pearls = Field()
diamonds = Field()
def _process_pearls(self):
# clean field
def _process(self):
# override clean all
super(Necklace, self)._process()
This plays nicely without intervening other classes their data unless you want to.. but that's where the pipeline is a nice opt-in 👍
The text was updated successfully, but these errors were encountered:
I don't really like the pipeline cycle as a basic clean cycle because most of the time it requires some sort of differentiation per Item leaf class.
My suggestion is to create something similar as django's forms.Form clean loop. Which does something similar like my usual work-around, e.g.:
Now in my class definitions I can do something like (normally extended with optional arguments):
This plays nicely without intervening other classes their data unless you want to.. but that's where the pipeline is a nice opt-in 👍
The text was updated successfully, but these errors were encountered: