Example #1
0
    def wrap_thing(thing):
        w = Wrapped(thing)
        
        if isinstance(thing, Link):
            w.render_class = InlineArticle
        elif isinstance(thing, Comment):
            w.render_class = InlineComment

        return w
Example #2
0
    def wrap_thing(thing):
        w = Wrapped(thing)
        
        if isinstance(thing, Link):
            w.render_class = InlineArticle
        elif isinstance(thing, Comment):
            w.render_class = InlineComment

        return w
Example #3
0
    def builder_wrapper(thing):
        w = Wrapped(thing)

        if isinstance(thing, Link):
            if thing.promoted:
                w = Wrapped(thing)
                w.render_class = PromotedLink
                w.rowstyle = 'promoted link'

            elif c.user.pref_compress:
                w.render_class = LinkCompressed
                w.score_fmt = Score.points

        return w
    def builder_wrapper(thing):
        w = Wrapped(thing)

        if isinstance(thing, Link):
            if thing.promoted:
                w = Wrapped(thing)
                w.render_class = PromotedLink
                w.rowstyle = 'promoted link'

            elif c.user.pref_compress:
                w.render_class = LinkCompressed
                w.score_fmt = Score.points

        return w
    def builder_wrapper(thing):
        w = Wrapped(thing)

        if isinstance(thing, Link):
            w.render_class = InlineArticle

        return w
Example #6
0
 def trial_wrap(item):
     if item is trial:
         w = Wrapped(item)
         w.trial_mode = True
         w.render_class = LinkOnTrial
         return w
     return self.builder_wrapper(item)
Example #7
0
    def builder_wrapper(thing):
        w = Wrapped(thing)

        if isinstance(thing, Link):
            w.render_class = InlineArticle

        return w
Example #8
0
 def trial_wrap(item):
    if item is trial:
        w = Wrapped(item)
        w.trial_mode = True
        w.render_class = LinkOnTrial
        return w
    return self.builder_wrapper(item)
Example #9
0
    def builder_wrapper(thing):
        w = Wrapped(thing)

        if c.user.pref_compress and isinstance(thing, Link):
            w.render_class = LinkCompressed
            w.score_fmt = Score.points

        return w
Example #10
0
 def _default_thing_wrapper(thing):
     w = Wrapped(thing)
     style = params.get('style', c.render_style)
     if isinstance(thing, Link):
         if thing.promoted is not None:
             w.render_class = PromotedLink
         elif style == 'htmllite':
             w.score_fmt = Score.safepoints
         w.should_incr_counts = style != 'htmllite'
     return w
Example #11
0
 def _default_thing_wrapper(thing):
     w = Wrapped(thing)
     style = params.get('style', c.render_style)
     if isinstance(thing, Link):
         if thing.promoted is not None:
             w.render_class = PromotedLink
         elif style == 'htmllite':
             w.score_fmt = Score.safepoints
         w.should_incr_counts = style != 'htmllite'
     return w
Example #12
0
 def _default_thing_wrapper(thing):
     w = Wrapped(thing)
     style = params.get('style', c.render_style)
     if isinstance(thing, Link):
         if thing.promoted is not None:
             w.render_class = PromotedLink
             w.rowstyle = 'promoted link'
         elif style == 'htmllite':
             w.score_fmt = Score.points
     return w
Example #13
0
 def _default_thing_wrapper(thing):
     w = Wrapped(thing)
     style = params.get("style", c.render_style)
     if isinstance(thing, Link):
         if thing.promoted:
             w.render_class = PromotedLink
             w.rowstyle = "promoted link"
         elif style == "htmllite":
             w.score_fmt = Score.points
     return w
Example #14
0
 def _default_thing_wrapper(thing):
     w = Wrapped(thing)
     style = params.get('style', c.render_style)
     if isinstance(thing, Link):
         if thing.promoted is not None:
             w.render_class = PromotedLink
             w.rowstyle = 'promoted link'
         elif style == 'htmllite':
             w.score_fmt = Score.points
     return w
Example #15
0
    def builder_wrapper(thing):
        if isinstance(thing, Comment):
            f = thing._fullname
            w = Wrapped(thing)
            w.render_class = Message
            w.to_id = c.user._id
            w.was_comment = True
            w._fullname = f
        else:
            w = ListingController.builder_wrapper(thing)

        return w
Example #16
0
    def builder_wrapper(thing):
        if isinstance(thing, Comment):
            f = thing._fullname
            w = Wrapped(thing)
            w.render_class = Message
            w.to_id = c.user._id
            w.was_comment = True
            w._fullname = f
        else:
            w = ListingController.builder_wrapper(thing)

        return w
Example #17
0
 def builder_wrapper(thing):
     if isinstance(thing, Comment):
         p = thing.make_permalink_slow()
         f = thing._fullname
         w = Wrapped(thing)
         w.render_class = Message
         w.to_id = c.user._id
         w.was_comment = True
         w.permalink, w._fullname = p, f
         return w
     else:
         return ListingController.builder_wrapper(thing)
Example #18
0
 def builder_wrapper(thing):
     if isinstance(thing, Comment):
         p = thing.make_permalink_slow()
         f = thing._fullname
         w = Wrapped(thing)
         w.render_class = Message
         w.to_id = c.user._id
         w.subject = _('Comment Reply')
         w.was_comment = True
         w.permalink, w._fullname = p, f
         return w
     else:
         return ListingController.builder_wrapper(thing)
Example #19
0
def sponsor_wrapper(link):
    w = Wrapped(link)
    w.render_class = PromotedLink
    w.rowstyle = "promoted link"
    return w
Example #20
0
def sponsor_wrapper(link):
    w = Wrapped(link)
    w.render_class = PromotedLink
    w.rowstyle = "promoted link"
    return w
Example #21
0
 def comment_permalink_wrapper(comment, link):
     wrapped = Wrapped(link, link_title=comment.make_permalink_title(link), for_comment_permalink=True)
     wrapped.render_class = CommentPermalink
     return wrapped
Example #22
0
 def comment_permalink_wrapper(comment, link):
     wrapped = Wrapped(link, link_title=comment.make_permalink_title(link), for_comment_permalink=True)
     wrapped.render_class = CommentPermalink
     return wrapped