## TODO
# fail_error
+ @property
+ def get_uploader(self):
+ # for compatibility
+ return self.get_actor
+
+ @property
+ def uploader(self):
+ # for compatibility
+ return self.actor
+
@property
def collections(self):
""" Get any collections that this MediaEntry is in """
query = query.order_by(Comment.added.asc())
else:
query = query.order_by(Comment.added.desc())
-
+
return query
-
+
def url_to_prev(self, urlgen):
"""get the next 'newer' entry by this user"""
media = MediaEntry.query.filter(
class Comment(Base):
"""
Link table between a response and another object that can have replies.
-
+
This acts as a link table between an object and the comments on it, it's
done like this so that you can look up all the comments without knowing
whhich comments are on an object before hand. Any object can be a comment
__tablename__ = "core__comment_links"
id = Column(Integer, primary_key=True)
-
+
# The GMR to the object the comment is on.
target_id = Column(
Integer,
# When it was added
added = Column(DateTime, nullable=False, default=datetime.datetime.utcnow)
-
+
+ @property
+ def get_author(self):
+ # for compatibility
+ return self.comment().get_actor # noqa
+
+ def __getattr__(self, attr):
+ try:
+ return getattr(self.comment(), attr) # noqa
+ except Exception as e:
+ print(e)
+ raise
class TextComment(Base, TextCommentMixin, CommentingMixin):
"""
if target is None:
target = {}
else:
- target = target.serialize(request, show_comments=False)
+ target = target.serialize(request, show_comments=False)
author = self.get_actor
if "location" in data:
Location.create(data["location"], self)
-
+
# Handle changing the reply ID
if "inReplyTo" in data:
# Validate that the ID is correct
link.target = media
link.comment = self
link.save()
-
+
return True
class Collection(Base, CollectionMixin, CommentingMixin):
seen = Column(Boolean, default=lambda: False, index=True)
user = relationship(
User,
- backref=backref('notifications', cascade='all, delete-orphan'))
+ backref=backref('notifications', cascade='all, delete-orphan'))
def __repr__(self):
return '<{klass} #{id}: {user}: {subject} ({seen})>'.format(
which points to the reported object.
"""
__tablename__ = 'core__reports'
-
+
id = Column(Integer, primary_key=True)
reporter_id = Column(Integer, ForeignKey(User.id), nullable=False)
reporter = relationship(
resolved = Column(DateTime)
result = Column(UnicodeText)
-
+
object_id = Column(Integer, ForeignKey(GenericModelReference.id), nullable=True)
object_helper = relationship(GenericModelReference)
obj = association_proxy("object_helper", "get_object",