Re: Pastebin plugin



Hi,

2010/2/12 Carlos Pais <carlosfvpais gmail com>:
>
> I improved my pastebin plugin, the previous one was here. Now it supports
> pastebin.com, pastebin.ca and paste.pocoo.org (Lodge It).
> Here's the new one:
> http://pastebin.ca/1794682
>
> Hope you like it.

I love it, this is going to be really useful! Also together with the
Textfile plugin in master.

Please accept some comments on the code. Do you want to address some
of these points to get this included in Kupfer?

Python style

No lines longer than 80 characters
Code indented with tabs
Use natural python code

This is nothing religious, but coding styles are important to keep the
code easy to understand and develop. PEP 8 is a good guide to
generally accepted python coding standards:
http://www.python.org/dev/peps/pep-0008/

I would like code like this  (tildes signify trailing whitespace) :

~~~~
    def getUrl(self,content,syntax,expire):
        params = {}
~~~~~~~~
        #params['poster']=user
        params['code']=content
        params['language']= syntax #The format, for syntax hilighting
        params['Paste!']="Paste!"
~~~~
        params = urllib.urlencode(params) #Convert to a format usable
with the HTML POST

To become like this:

    def get_url(self, content, syntax, expire):
        params = {
            "code": content,
            "language": syntax,
            "Paste!": "Paste!",
        }
        # Convert to a format usable with the HTML POST
        params = urllib.urlencode(params)
        page = urllib.urlopen(self.website + "/", params)
        return page.url

Also, I think the language dictionaries are probably better with one
language per line, it is easier to edit. You don't need any '\'.

Best Regards,
ulrik


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]