Switch to unified view

a/ForgeChat/forgechat/command.py b/ForgeChat/forgechat/command.py
...
...
14
from ming.orm import session, ThreadLocalORMSession
14
from ming.orm import session, ThreadLocalORMSession
15
15
16
import allura
16
import allura
17
from allura.command import base
17
from allura.command import base
18
from allura.lib import helpers as h
18
from allura.lib import helpers as h
19
from allura.lib import search
19
from allura.lib import search, security
20
from allura import model as M
20
from allura import model as M
21
21
22
from forgechat import model as CM
22
from forgechat import model as CM
23
23
24
class IRCBotCommand(allura.command.Command):
24
class IRCBotCommand(allura.command.Command):
...
...
142
                      app_config_id=chan.app_config_id)
142
                      app_config_id=chan.app_config_id)
143
        return True
143
        return True
144
144
145
    def handle_shortlink(self, lnk, sender, rcpt):
145
    def handle_shortlink(self, lnk, sender, rcpt):
146
        art = lnk.ref.artifact
146
        art = lnk.ref.artifact
147
        if security.has_access(art, 'read', user=M.User.anonymous())():
147
        index = art.index()
148
            index = art.index()
148
        text = index['snippet_s'] or index['title_s']
149
            text = index['snippet_s'] or index['title_s']
149
        url = urljoin(tg.config.get('base_url', 'http://sourceforge.net'), index['url_s'])
150
            url = urljoin(tg.config.get('base_url', 'http://sourceforge.net'), index['url_s'])
150
        self.notice(rcpt, '[%s] - [%s](%s)' % (lnk.link, text,url))
151
            self.notice(rcpt, '[%s] - [%s](%s)' % (lnk.link, text,url))
151
152
152
    def log_channel(self, sender, cmd, rcpt, rest):
153
    def log_channel(self, sender, cmd, rcpt, rest):
153
        if cmd not in ('NOTICE', 'PRIVMSG'):
154
        if cmd not in ('NOTICE', 'PRIVMSG'):
154
            self.logger.debug('IGN: %s %s %s %s', sender, cmd, rcpt, rest)
155
            self.logger.debug('IGN: %s %s %s %s', sender, cmd, rcpt, rest)
155
            return
156
            return