equal
deleted
inserted
replaced
41 """ |
41 """ |
42 |
42 |
43 super(Logic, self).__init__(model, base_model=base_model, |
43 super(Logic, self).__init__(model, base_model=base_model, |
44 id_based=id_based) |
44 id_based=id_based) |
45 |
45 |
|
46 def getOrCreateTaskSubscriptionForTask(self, task_entity): |
|
47 """Gets or creates a TaskSubscription entity for the given GHOPTask. |
|
48 |
|
49 Args: |
|
50 task_entity: GHOPTask entity |
|
51 |
|
52 Returns: |
|
53 Existing TaskSubscription entity iff any exists, otherwise a new |
|
54 TaskSubscription entity. |
|
55 """ |
|
56 |
|
57 fields = {'task': task_entity} |
|
58 |
|
59 task_subscription = self.getForFields(fields, unique=True) |
|
60 |
|
61 if not task_subscription: |
|
62 task_subscription = self.updateOrCreateFromFields(fields) |
|
63 |
|
64 return task_subscription |
|
65 |
46 |
66 |
47 logic = Logic() |
67 logic = Logic() |