예제 #1
0
 def save(self):
     if not self.id and self.post_elsewhere:
         import pydelicious
         pydelicious.add(settings.DELICIOUS_USER, settings.DELICIOUS_PASSWORD, smart_str(self.url),smart_str(self.title),smart_str(self.tags))
     if self.description:
         self.description_html = markdown(self.description)
     super(Link, self).save()
예제 #2
0
 def _post_to_delicious(self):
     import pydelicious
     try:
         pydelicious.add(settings.DELICIOUS_USERNAME, settings.DELICIOUS_PASSWORD, self.url, self.description, self.tags, self.extended_info)
     except:
         pass
     self.post_elsewhere = False
     return self
예제 #3
0
	def save(self):
		if self.description:
			self.description_html= markdown(self.description)
		if not self.id and self.post_elsewhere:
			import pydelicious
			from django.utils.encoding import smart_str
			pydelicious.add(settings.DELICIOUS_USERNAME, settings.DELICIOUS_PASSWORD,
							smart_str(self.url),smart_str(self.title), smart_str(self.tags))
		super(Link, self).save()
예제 #4
0
 def save(self):
     if self.description:
         self.description_html = markdown(self.description)
     if not self.id and self.post_elsewhere:
         try:
             pydelicious.add(settings.DELICIOUS_USER, settings.DELICIOUS_PASSWORD,
                             smart_str(self.url), smart_str(self.title), tags=smart_str(self.tags))
         except pydelicious.DeliciousError:
             pass
     super(Link, self).save()
예제 #5
0
 def save(self):
     if not self.id and self.post_elsewhere:
         import pydelicious
         try:
             pydelicious.add(settings.DELICIOUS_USER, settings.DELICIOUS_PASSWORD, smart_str(self.url), smart_str(self.title), smart_str(self.tags))
         except:
             pass # TODO: don't just silently quash a bad del.icio.us post
     if self.description:
         self.description_html = formatter(self.description)
     super(Link, self).save()
예제 #6
0
 def save(self):
     if self.description:
         self.description_html = markdown(self.description)
     if not self.id and self.post_elsewhere:
         import pydelicious
         from django.utils.encoding import smart_str
         pydelicious.add(settings.DELICIOUS_USER, settings.DELICIOUS_PWD,
                         smart_str(self.url), smart_str(self.title),
                         smart_str(self.tags))
     super(Link, self).save()
예제 #7
0
파일: models.py 프로젝트: redsnapper8t8/jot
 def save(self, force_insert=False, force_update=False):
     if not self.id and self.post_elsewhere:
         import pydelicious
         from django.utils.encoding import smart_str
         pydelicious.add(settings.DELICIOUS_USER, settings.DELICIOUS_PASSWORD,
                         smart_str(self.url), smart_str(self.title),
                         smart_str(self.tags))
     #if self.description:
     #    self.description_html = markdown(self.description)
     super(Link, self).save()
예제 #8
0
	def save(self,force_insert=False,force_update=False):
                if not self.id and self.post_elsewhere:
                        import pydelicious
			from pydelicious import DeliciousAPI
			from getpass import getpass
#			a = DeliciousAPI('*****@*****.**', getpass('Fastrack!23'))
#			a.posts_add(smart_str(self.url),smart_str(self.title),smart_str(self.tag))
                        pydelicious.add(settings.DELICIOUS_USER,settings.DELICIOUS_PASSWORD,smart_str(self.url),smart_str(self.title),smart_str(self.tag))
#			pydelicious.add('*****@*****.**','Fastrack!23',smart_str(self.url),smart_str(self.title),smart_str(self.tag))	
                if self.description :
                        self.description_html=markdown(self.description)
                super(Link,self).save(force_insert=False,force_update=False)
예제 #9
0
파일: models.py 프로젝트: DanHoerst/cms
 def save(self):
     if self.description:
         self.description_html = markdown(self.description)
     if not self.id and self.post_elsewhere:
         # import pydelicious dependancy to send to del.icio.us
         import pydelicious
         # import smart_str to change unicode to str to send over web API
         from django.utils.encoding import smart_str
         pydelicious.add(settings.DELICIOUS_USER, settings.DELICIOUS_PASSWORD,
                         smart_str(self.url), smart_str(self.title),
                         smart_str(self.tags))
     super(Link, self).save()
예제 #10
0
    def post(self, item):
        """post teh item at delicious"""
        if not item.title:
            item.title = getpagetitle(item.url) or self.inputwidget("title")
            item.title = unicode(item.title, errors='ignore')

        # launch posting in a new thread ?
        pydelicious.add(
                self.conf.get('login'), self.conf.get('pass'),
                item.url, item.title, tags=' '.join(item.tags))

#        threading.Thread(None, pydelicious.add,
#            (self.conf.get('login'), self.conf.get('pass'), item.url, item.title),
#            {'tags' : ' '.join(item.tags)}).start()

        item.post()
예제 #11
0
파일: plugin.py 프로젝트: nixon/boombot
 def grabUrl(self, irc, msg, match):
     r"https?://[^\])>\s]{5,}.+$"
     try:
         channel = msg.args[0]
         if not irc.isChannel(channel): return
         str = match.group().split()
         url = str[0]
         domain = urlsplit(url)[1]
         # just hide certain URLs
         if re.match(".*ibm.com$",domain.lower()):
             return
         if gethostbyname(domain):
             desc = url
             if len(str) > 1:
                 if re.match("[\W]+",str[1]):
                     if len(str) > 2:
                         desc = ' '.join(str[2:])
                 else:
                     desc = ' '.join(str[1:])
            # now check that it's not malicious 
             config = ConfigParser.ConfigParser()
             config.readfp(open(os.path.expanduser('~/.boombot.cfg')))
             safebrowsing_db_path = config.get('safebrowsing', 'db_path')
             lookup = Lookup(safebrowsing_db_path)
             verdict = lookup.lookup_by_url(url)
             if not verdict:
                 res = pydelicious.add(self.__dUser,self.__dPass,url,url,msg.nick,desc)
             else:
                 uuu = url.replace("http", "hXXp")
                 if len(uuu) > 14: uuu = uuu[:9] + "..." + uuu[-5:]
                 else: uuu = uuu[:8] + "..."
                 irc.reply("MALICIOUS URL! Not saving %s to del.icio.us" % uuu)
     except:
         pass
예제 #12
0
    def save(self, force_insert=False, force_update=False, using=None, update_fields=None):
        """
        Saves a link.  Updates the rendered description HTML and make sure the link gets posted elsewhere.
        """

        if self.description:
            self.description_html = markdown(self.description)

        # Update delicious
        if not self.id and self.post_elsewhere:
            import pydelicious
            pydelicious.add(settings.DELICIOUS_USER, settings.DELICIOUS_PASSWORD,
                            smart_str(self.url), smart_str(self.title), smart_str(self.tags))

        super(Link, self).save(force_insert=force_insert, force_update=force_update, using=using,
                               update_fields=update_fields)
예제 #13
0
    def save(self,
             force_insert=False,
             force_update=False,
             using=None,
             update_fields=None):
        """
        Saves a link.  Updates the rendered description HTML and make sure the link gets posted elsewhere.
        """

        if self.description:
            self.description_html = markdown(self.description)

        # Update delicious
        if not self.id and self.post_elsewhere:
            import pydelicious
            pydelicious.add(settings.DELICIOUS_USER,
                            settings.DELICIOUS_PASSWORD, smart_str(self.url),
                            smart_str(self.title), smart_str(self.tags))

        super(Link, self).save(force_insert=force_insert,
                               force_update=force_update,
                               using=using,
                               update_fields=update_fields)
예제 #14
0
 def grabUrl(self, irc, msg, match):
     r"https?://[^\])>\s]{5,}.+$"
     try:
         channel = msg.args[0]
         if not irc.isChannel(channel): return
         str = match.group().split()
         url = str[0]
         domain = urlsplit(url)[1]
         # just hide certain URLs
         if re.match(".*ibm.com$", domain.lower()):
             return
         if gethostbyname(domain):
             desc = url
             if len(str) > 1:
                 if re.match("[\W]+", str[1]):
                     if len(str) > 2:
                         desc = ' '.join(str[2:])
                 else:
                     desc = ' '.join(str[1:])
         # now check that it's not malicious
         #config = ConfigParser.ConfigParser()
         #config.readfp(open(os.path.expanduser('~/.boombot.cfg')))
         #safebrowsing_db_path = config.get('safebrowsing', 'db_path')
         #lookup = Lookup()
         #verdict = lookup.lookup_by_url(url)
             if not 0:
                 res = pydelicious.add(self.__dUser, self.__dPass, url, url,
                                       msg.nick, desc)
             else:
                 uuu = url.replace("http", "hXXp")
                 if len(uuu) > 14: uuu = uuu[:9] + "..." + uuu[-5:]
                 else: uuu = uuu[:8] + "..."
                 irc.reply("MALICIOUS URL! Not saving %s to del.icio.us" %
                           uuu)
     except Exception, e:
         error = '%s' % (e)
         #irc.reply(error)
         pass