Пример #1
0
    def __init__(self, lu_event, **kw):
        kw.setdefault("topic", "live_thread_events")
        super(LiveUpdateEvent, self).__init__(**kw)

        self.add("live_thread_id", lu_event._id)
        self.add_text("live_thread_title", lu_event.title)
        self.add_text("live_thread_description", lu_event.description)
        self.add("live_thread_created_ts", _datetime_to_millis(lu_event._date))
        if lu_event.banned:
            self.add_text("live_thread_banned_by", lu_event.banned_by)

        self.add_if_true("live_thread_banned", lu_event.banned)
        self.add_if_true("live_thread_nsfw", lu_event.nsfw)
    def __init__(self, lu_event, **kw):
        kw.setdefault("topic", "live_thread_events")
        super(LiveUpdateEvent, self).__init__(**kw)

        self.add("live_thread_id", lu_event._id)
        self.add_text("live_thread_title", lu_event.title)
        self.add_text("live_thread_description", lu_event.description)
        self.add(
            "live_thread_created_ts",
            _datetime_to_millis(lu_event._date)
        )
        if lu_event.banned:
            self.add_text("live_thread_banned_by", lu_event.banned_by)

        self.add_if_true("live_thread_banned", lu_event.banned)
        self.add_if_true("live_thread_nsfw", lu_event.nsfw)
Пример #3
0
def update_event(update, context, stricken=False, request=None):
    event = LiveUpdateEvent(
        context.liveupdate_event,
        event_type="live_thread_update",
        request=request,
        context=context,
    )
    event.add_if_true("live_thread_update_stricken", stricken)
    event.add("live_thread_update_id", str(update._id))
    event.add("live_thread_update_fullname", update._fullname)
    event.add_if_true("live_thread_update_deleted", update.deleted)
    event.add_if_true("live_thread_update_banned", update._spam)
    event.add("live_thread_update_created_ts",
              _datetime_to_millis(update._date))
    if hasattr(update, "body"):
        event.add_text("live_thread_update_body", update.body)

    g.events.save_event(event)
def update_event(update, context, stricken=False, request=None):
    event = LiveUpdateEvent(
        context.liveupdate_event,
        event_type="live_thread_update",
        request=request,
        context=context,
    )
    event.add_if_true("live_thread_update_stricken", stricken)
    event.add("live_thread_update_id", str(update._id))
    event.add("live_thread_update_fullname", update._fullname)
    event.add_if_true("live_thread_update_deleted", update.deleted)
    event.add_if_true("live_thread_update_banned", update._spam)
    event.add(
        "live_thread_update_created_ts", _datetime_to_millis(update._date))
    if hasattr(update, "body"):
        event.add_text("live_thread_update_body", update.body)

    g.events.save_event(event)