Commits

Gregory Petukhov committed 34ead47

Add USE_SHORT_URL setting

  • Participants
  • Parent commits 845de43

Comments (0)

Files changed (2)

     for start in xrange(0, len(items), step):
         message = []
         for item in items[start:start + step]:
-            link = shorturl.get(item['link'])
-            host = urlsplit(item['link']).hostname
-            message.append(u'%s %s (%s)' % (item['title'], link, host))
+            if settings.USE_SHORT_URL:
+                link = shorturl.get(item['link'])
+                host = urlsplit(item['link']).hostname
+                line = u'%s %s (%s)' % (item['title'], link, host)
+            else:
+                link = item['link']
+                line = u'%s %s' % (item['title'], link)
+            message.append(line)
         message = '\n'.join(message)
         client.send(xmpp.Message(to=settings.NOTIFY_ROOM, typ='groupchat', body=message))
         time.sleep(settings.MESSAGE_DELAY)

settings.py.template

 ]
 LIMIT_PER_MESSAGE = 3
 LIMIT_PER_FEED = 3
+USE_SHORT_URL = True
 
 """
 Example of config for pythonua@c.j.r:
 ]
 LIMIT_PER_MESSAGE = 3
 LIMIT_PER_FEED = 3
+USE_SHORT_URL = True
 """