Beispiel #1
0
 def __init__(self, id, trashed, app, authors, title, duration,
              description):
     super().__init__(id=id, trashed=trashed, app=app)
     Editable.__init__(self, authors=authors)
     self.title = title
     self.duration = duration
     self.description = description
Beispiel #2
0
 def __init__(self, *, id, app, authors, title, description, features, mode, activity):
     super().__init__(id=id, app=app)
     Editable.__init__(self, authors=authors, activity=activity)
     self.title = title
     self.description = description
     self.features = features
     self.mode = mode
     self.items = List.Items((self, 'items'))
     self.activity = activity
     self.activity.post = self._on_activity_publish
     self.activity.host = self
Beispiel #3
0
 def __init__(self, *, id, app, authors, trashed, text, resource, list_id, title, location,
              checked):
     super().__init__(id, app)
     Editable.__init__(self, authors, lambda: self.list.activity)
     Trashable.__init__(self, trashed, lambda: self.list.activity)
     WithContent.__init__(self, text=text, resource=resource)
     self._list_id = list_id
     self.title = title
     self.location = Location.parse(location) if location else None
     self.checked = checked
     self.assignees = Item.Assignees(self, app=app)
     self.votes = Item.Votes(self, app=app)
Beispiel #4
0
    def __init__(self, id, trashed, app, authors, title, time, location, description):
        super().__init__(id=id, trashed=trashed, app=app)
        Editable.__init__(self, authors=authors)
        self.title = title
        self.time = time
        self.location = location
        self.description = description

        self._items_key = self.id + '.items'
        self._trashed_items_key = self.id + '.trashed_items'
        self.items = JSONRedisMapping(self.app.r, self._items_key)
        self.trashed_items = JSONRedisMapping(self.app.r, self._trashed_items_key)
Beispiel #5
0
    def __init__(self, id, trashed, app, authors, title, time, location,
                 description):
        super().__init__(id=id, trashed=trashed, app=app)
        Editable.__init__(self, authors=authors)
        self.title = title
        self.time = parse_isotime(time) if time else None
        self.location = location
        self.description = description

        self._items_key = self.id + '.items'
        self._trashed_items_key = self.id + '.trashed_items'
        self.items = JSONRedisMapping(self.app.r, self._items_key)
        self.trashed_items = JSONRedisMapping(self.app.r,
                                              self._trashed_items_key)
Beispiel #6
0
 def json(self, restricted=False, include_users=False):
     json = super().json(attrs={
         'title': self.title,
         'duration': self.duration,
         'description': self.description
     })
     json.update(Editable.json(self, restricted=restricted, include_users=include_users))
     return json
Beispiel #7
0
 def json(self, restricted=False, include=False):
     json = super().json(restricted=restricted, include=include)
     json.update(Editable.json(self, restricted=restricted,
                               include=include))
     json.update({
         'title': self.title,
         'duration': self.duration,
         'description': self.description
     })
     return json
Beispiel #8
0
 def json(self, restricted=False, include=False):
     return {
         **super().json(restricted, include),
         **Editable.json(self, restricted, include),
         **Trashable.json(self, restricted, include),
         **WithContent.json(self, restricted, include), 'list_id':
         self._list_id,
         'title': self.title,
         'location': self.location.json() if self.location else None,
         'checked': self.checked
     }
Beispiel #9
0
 def json(self, restricted=False, include=False):
     return {
         **super().json(restricted, include),
         **Editable.json(self, restricted, include),
         'title': self.title,
         'description': self.description,
         'features': self.features,
         'mode': self.mode,
         'activity': self.activity.json(restricted),
         **({'items': self.items.json(restricted=restricted, include=include)} if restricted
            else {}),
     }
Beispiel #10
0
 def __init__(self,
              *,
              id,
              app,
              authors,
              trashed,
              text,
              resource,
              list_id,
              title,
              location=None,
              checked):
     # Compatibility for Item without location (deprecated since 0.6.0)
     super().__init__(id, app)
     Editable.__init__(self, authors, lambda: self.list.activity)
     Trashable.__init__(self, trashed, lambda: self.list.activity)
     WithContent.__init__(self, text=text, resource=resource)
     self._list_id = list_id
     self.title = title
     self.location = Location.parse(location) if location else None
     self.checked = checked
Beispiel #11
0
 def json(self, restricted=False, include=False, *, rewrite=None):
     return {
         **super().json(restricted=restricted,
                        include=include,
                        rewrite=rewrite),
         **Editable.json(self,
                         restricted=restricted,
                         include=include,
                         rewrite=rewrite),
         **WithContent.json(self,
                            restricted=restricted,
                            include=include,
                            rewrite=rewrite)
     }
Beispiel #12
0
 def json(self, restricted=False, include=False):
     return {
         **super().json(restricted, include),
         **Editable.json(self, restricted, include),
         **Trashable.json(self, restricted, include),
         **WithContent.json(self, restricted, include),
         'list_id': self._list_id,
         'title': self.title,
         'location': self.location.json() if self.location else None,
         'checked': self.checked,
         **(
             {
                 'assignees':
                     self.assignees.json(restricted=restricted, include=include, slc=slice(None))
             } if include else {}),
         **({'votes': self.votes.json(restricted=restricted, include=include)} if include
            else {})
     }
Beispiel #13
0
    def json(self, restricted=False, include_users=False, include_items=False):
        """See :meth:`Object.json`.

        If *include_items* is ``True``, *items* and *trashed_items* are included.
        """
        # pylint: disable=arguments-differ; extended signature
        json = super().json(attrs={
            'title': self.title,
            'time': self.time.isoformat() + 'Z' if self.time else None,
            'location': self.location,
            'description': self.description
        })
        json.update(Editable.json(self, restricted=restricted, include_users=include_users))
        if include_items:
            json['items'] = [i.json(restricted=restricted, include_users=include_users)
                             for i in self.items.values()]
            json['trashed_items'] = [i.json(restricted=restricted, include_users=include_users)
                                     for i in self.trashed_items.values()]
        return json
Beispiel #14
0
    def json(self, restricted=False, include=False):
        """See :meth:`Object.json`.

        If *include_items* is ``True``, *items* and *trashed_items* are included.
        """
        json = super().json(restricted=restricted, include=include)
        json.update(Editable.json(self, restricted=restricted,
                                  include=include))
        json.update({
            'title': self.title,
            'time': self.time.isoformat() + 'Z' if self.time else None,
            'location': self.location,
            'description': self.description
        })
        if include:
            json['items'] = [
                i.json(restricted=restricted, include=include)
                for i in self.items.values()
            ]
            json['trashed_items'] = [
                i.json(restricted=restricted, include=include)
                for i in self.trashed_items.values()
            ]
        return json
Beispiel #15
0
 def json(self, restricted=False, include_users=False):
     json = super().json(attrs={'name': self.name})
     json.update(Editable.json(self, restricted=restricted, include_users=include_users))
     return json
Beispiel #16
0
 def __init__(self, id, trashed, app, authors, name):
     super().__init__(id=id, trashed=trashed, app=app)
     Editable.__init__(self, authors=authors)
     self.name = name
Beispiel #17
0
 def __init__(self, *, id, app, authors, text, resource):
     super().__init__(id, app)
     Editable.__init__(self, authors)
     WithContent.__init__(self, text=text, resource=resource)
Beispiel #18
0
 def __init__(self, *, app: Hello, **data: object) -> None:
     super().__init__(id=cast(str, data['id']), app=app)
     Editable.__init__(self, authors=cast(List[str], data['authors']))
     WithContent.__init__(self, text=cast(Optional[str], data['text']),
                          resource=cast(Optional[Resource], data['resource']))
Beispiel #19
0
 def __init__(self, id, trashed, app, authors, title, duration, description):
     super().__init__(id=id, trashed=trashed, app=app)
     Editable.__init__(self, authors=authors)
     self.title = title
     self.duration = duration
     self.description = description