Hacker News new | past | comments | ask | show | jobs | submit login
Denied: Python Micro-Framework (Sinatra-like) (immersedcode.org)
62 points by thisduck on April 2, 2010 | hide | past | favorite | 25 comments



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.


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.


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).


As you agreed, it has visual similarities to a virus. That's all.


It's not a virus, it just unpacks wurkeug, jinja, simplejson, and probably some other stuff. Pretty much it's an epic hack.


The contact email is also

armin.ronacher+dontbelieveanythingontheinternet@active-4.com

So.


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.


I should have announced my Bash microframework, martin, yesterday: http://github.com/tlrobinson/wwwoosh/blob/master/martin.sh


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 :)


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).


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.


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.


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.



i didn't get it at first, the raw link helps http://github.com/denied/denied/raw/master/deny.py


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


Because I wanted that trendy "fork me on github" badge on the website. And for that a code repository has to exist :)


Bragging rights about the whole framework "fitting" in only 47 lines of code?

I'd hate to submit patches to this.


405k. That's not my idea of "micro".


Not as pretty as Sinatra's example page, but I like the home page for the project! Great name too.


It would be good joke, only... Python has so many ugly web-frameworks, that this doesn't make any difference.


    if __name__ == '__main__':
        run()
Am I the only one who thinks that this is just plain horrible? It's incomprehensible voodoo.


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.


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.


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).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: