コード例 #1
0
ファイル: util.py プロジェクト: HoverHell/xmppforum
def diff_processtext(text):
    """ Prepares the supplied post text to be diff'ed.  """
    from snapboard.templatetags.extras import render_filter
    texth = render_filter(text)  # -> html
    textl = re.findall(r'<[^>]*?>|[^<]+', texth)  # -> tags&text
    out = []
    for item in textl:  # -> tags & words.
        if item.startswith("<"):
            out.append(item)
        else:
            #out += item.split()  # Extra spaces?
            #out += re.findall(r'[ ]+|[^ ]+', item)
            out += list(item)  # by-symbol diff o_O
    return out
コード例 #2
0
ファイル: models.py プロジェクト: HoverHell/xmppforum
    def save(self, force_insert=False, force_update=False):
        # ? huh?
        #_log.debug('user = %s, ip = %s' % (threadlocals.get_current_ip(),
        #    threadlocals.get_current_user()))

        # hack to disallow admin setting arbitrary users to posts
        if getattr(self, 'user_id', None) is None:
            self.user_id = threadlocals.get_current_user().id

        # disregard any modifications to ip address
        self.ip = threadlocals.get_current_ip()

        # ! XXX: Not really appropriate to do it here?..
        from snapboard.templatetags.extras import render_filter
        self.texth = render_filter(self.text)
        
        super(Post, self).save(force_insert, force_update)
        ## Update the thread-local id afterwards.
        self.update_lid()
コード例 #3
0
ファイル: rpc.py プロジェクト: flynhigher/terry-play-ground
def _sanitize(text):
    return render_filter(striptags(text), "safe")
コード例 #4
0
ファイル: rpc.py プロジェクト: kdunn926/snapboard17
def _sanitize(text):
    return render_filter(striptags(text), "safe")