News for hackers. Stuff that matters.
Re:Denied: Python Micro-Framework (Sinatra-like) by Gonsalu on Friday April 02, 2010 @05:37PM (#1237643)
I think this is supposed to be a April's fools joke.

- github user created in April's 1st (http://github.com/denied)

- contact is an email link to Armin Ronacher (http://github.com/mitsuhiko), who actually published the denied code in github

- code basically just uses jinja2 and werkzeug, which are a template language and a web framework, respectively, which Armin works on

So... yeah.

Re:Denied: Python Micro-Framework (Sinatra-like) by jerf on Friday April 02, 2010 @08:50PM (#1237926)
What it looks like is a virus: http://github.com/denied/denied/blob/master/deny.py

I'm very much not saying that's what it is. Looking at the end it looks like an encoded zip file which the code extracts. Perhaps somebody else will be kind enough to run it and find out what it does. I'd feel too guilty, having told too many people not to do that.

Re:Denied: Python Micro-Framework (Sinatra-like) by ubernostrum on Friday April 02, 2010 @11:57PM (#1238138)
What it looks like is a virus

Because it happens to use a base64-encoded string to obscure some of what it's doing? Yes, there's malware which does that, but this is also such an ancient trick in humorous code obfuscation that it seems silly to jump to the level of paranoia you're displaying (especially given that A) it's by a well-known member of the Python community and B) it was published April 1).

Re:Denied: Python Micro-Framework (Sinatra-like) by jerf on Saturday April 03, 2010 @09:08AM (#1238569)
As you agreed, it has visual similarities to a virus. That's all.
Re:Denied: Python Micro-Framework (Sinatra-like) by kingkilr on Friday April 02, 2010 @10:24PM (#1238046)
It's not a virus, it just unpacks wurkeug, jinja, simplejson, and probably some other stuff. Pretty much it's an epic hack.
Re:Denied: Python Micro-Framework (Sinatra-like) by tel on Saturday April 03, 2010 @02:50AM (#1238334)
The contact email is also

[email protected]

So.

Re:Denied: Python Micro-Framework (Sinatra-like) by moe on Friday April 02, 2010 @07:57PM (#1237864)
My first reflex when I saw this was to think that it's meant as a tongue-in-cheek sidekick on the recent microframework-craze. Still not sure about the intention, but as others have pointed out, yes it's an April's fools.
Re:Denied: Python Micro-Framework (Sinatra-like) by tlrobinson on Friday April 02, 2010 @08:38PM (#1237908)
I should have announced my Bash microframework, martin, yesterday: http://github.com/tlrobinson/wwwoosh/blob/master/martin.sh
Re:Denied: Python Micro-Framework (Sinatra-like) by theli0nheart on Friday April 02, 2010 @05:27PM (#1237622)
This looks really similar to Bottle. http://github.com/defnull/bottle

I haven't looked at the source, and the documentation is nonexistent, but the example app and the routing look really close. See http://bottle.paws.de/ also.

Edit: Made comment a little less harsh :)

Re:Denied: Python Micro-Framework (Sinatra-like) by the_mitsuhiko on Friday April 02, 2010 @05:54PM (#1237678)
Werkzeug had an example with the same semantics (decorator for URL rules and returning strings and response objects from functions) for a long time. But neither did Werkzeug come up with that, the original idea was TurboGears which did it that way. So by that logic, bottle is a cheap knockoff.

However, I do have to point out that denied is a joke which should be pretty obvious from reading the source and watching the screencast (and quite frankly, just by looking at the website in detail).

Re:Denied: Python Micro-Framework (Sinatra-like) by csytan on Friday April 02, 2010 @05:45PM (#1237658)
Saying it's a cheap knockoff is harsh.

Every new framework copies something from existing ones. Setting routes with a decorator seems pretty obvious if you've seen Sinatra, and the templating language is more inspired by Django than anything else.

Re:Denied: Python Micro-Framework (Sinatra-like) by telemachos on Friday April 02, 2010 @11:14PM (#1238094)
If anyone liked the idea, but not as a joke, there is itty:

http://github.com/toastdriven/itty/

It's a self-described "little-experiment" based on Sinatra.

Re:Denied: Python Micro-Framework (Sinatra-like) by brandon on Friday April 02, 2010 @06:57PM (#1237784)
To be frank, I'm not going to TOUCH a library that contains 400k of base64-encoded zip data.

If it wasn't actually an April fools joke, bad form.

Re:Denied: Python Micro-Framework (Sinatra-like) by icey on Friday April 02, 2010 @04:14PM (#1237454)
Re:Denied: Python Micro-Framework (Sinatra-like) by dustingetz on Friday April 02, 2010 @05:22PM (#1237613)
i didn't get it at first, the raw link helps http://github.com/denied/denied/raw/master/deny.py
Re:Denied: Python Micro-Framework (Sinatra-like) by plq on Friday April 02, 2010 @05:02PM (#1237569)
okay, i can't figure out for the life of me why one would put source code in such a format up in a public code repository.

or why one would ever want to deploy server-side python code in this manner.

here's the one-liner to extract it btw: tail deny.py -n1 | cut -d\' -f4 | base64 -d > denied.zip

Re:Denied: Python Micro-Framework (Sinatra-like) by the_mitsuhiko on Friday April 02, 2010 @05:56PM (#1237685)
Because I wanted that trendy "fork me on github" badge on the website. And for that a code repository has to exist :)
Re:Denied: Python Micro-Framework (Sinatra-like) by tednaleid on Friday April 02, 2010 @05:03PM (#1237576)
Bragging rights about the whole framework "fitting" in only 47 lines of code?

I'd hate to submit patches to this.

Re:Denied: Python Micro-Framework (Sinatra-like) by bartl on Friday April 02, 2010 @05:25PM (#1237617)
405k. That's not my idea of "micro".
Re:Denied: Python Micro-Framework (Sinatra-like) by krainboltgreene on Friday April 02, 2010 @05:30PM (#1237627)
Not as pretty as Sinatra's example page, but I like the home page for the project! Great name too.
Re:Denied: Python Micro-Framework (Sinatra-like) by oinopion on Friday April 02, 2010 @06:35PM (#1237756)
It would be good joke, only... Python has so many ugly web-frameworks, that this doesn't make any difference.
Re:Denied: Python Micro-Framework (Sinatra-like) by bartl on Friday April 02, 2010 @05:22PM (#1237615)

    if __name__ == '__main__':
        run()
Am I the only one who thinks that this is just plain horrible? It's incomprehensible voodoo.
Re:Denied: Python Micro-Framework (Sinatra-like) by csytan on Friday April 02, 2010 @05:28PM (#1237624)
This is commonly used in python modules which can also be run by command line.

http://effbot.org/pyfaq/tutor-what-is-if-name-main-for.htm

I do agree though, it would be better to remove the if statement altogether since it's unlikely to be imported as a module.

Re:Denied: Python Micro-Framework (Sinatra-like) by the_mitsuhiko on Friday April 02, 2010 @05:55PM (#1237680)
Well, the run() function was intended to be a very bad example of API. Because there is that magical application object you never see that run magically picks up.

There is another example of really bad API in denied: there is a template render function internally (you have to read the code behind the code to see that) which magically accepts both filenames for templates and template source strings. And there are a couple of more examples of really, really bad ideas in that code.

Re:Denied: Python Micro-Framework (Sinatra-like) by pyre on Friday April 02, 2010 @07:01PM (#1237792)
By the same token, I could look at (any) Ruby code and call it the same thing seeing as it is a far enough deviation from 'C-like' languages and I haven't bothered to learn it yet. The "if __name__= '__main__':" convention is pretty well-established in Python. __name__ is only '__main__' when the script is the 'main' script being run (i.e. it wasn't imported as a module/package).