6 ms·
Denied: Python Micro-Framework (Sinatra-like)
- brandon 17y agoTo 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.
- icey 17y agoThe source is good for a laugh: http://github.com/denied/denied/blob/master/deny.py http://github.com/denied/denied/blob/master/deny.py
- plq 17y agookay, 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
- tednaleid 17y agoBragging rights about the whole framework "fitting" in only 47 lines of code? I'd hate to submit patches to this.
- bartl 17y ago405k. That's not my idea of "micro".
- the_mitsuhiko 17y agoBecause I wanted that trendy "fork me on github" badge on the website. And for that a code repository has to exist :)
- dustingetz 17y agoi didn't get it at first, the raw link helps http://github.com/denied/denied/raw/master/deny.py http://github.com/denied/denied/raw/master/deny.py
- deleted 17y ago[deleted]
- bartl 17y agoif __name__ == '__main__': run() Am I the only one who thinks that this is just plain horrible? It's incomprehensible voodoo.
- pyre 17y agoBy 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).
- csytan 17y agoThis 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 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.
- deleted 17y ago[deleted]
- the_mitsuhiko 17y agoWell, 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.
- theli0nheart 17y agoThis looks really similar to Bottle. http://github.com/defnull/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/ http://bottle.paws.de/ also. Edit: Made comment a little less harsh :)
- csytan 17y agoSaying 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.
- the_mitsuhiko 17y agoWerkzeug 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).
- krainboltgreene 17y agoNot as pretty as Sinatra's example page, but I like the home page for the project! Great name too.
- Gonsalu 17y agoI think this is supposed to be a April's fools joke. - github user created in April's 1st (http://github.com/denied http://github.com/denied) - contact is an email link to Armin Ronacher (http://github.com/mitsuhiko 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.
- moe 17y agoMy 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.
- tlrobinson 17y agoI should have announced my Bash microframework, martin, yesterday: http://github.com/tlrobinson/wwwoosh/blob/master/martin.sh http://github.com/tlrobinson/wwwoosh/blob/master/martin.sh
- jerf 17y agoWhat it looks like is a virus: http://github.com/denied/denied/blob/master/deny.py 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.
- kingkilr 17y agoIt's not a virus, it just unpacks wurkeug, jinja, simplejson, and probably some other stuff. Pretty much it's an epic hack.
- ubernostrum 17y agoWhat 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).
- deleted 17y ago[deleted]
- oinopion 17y agoIt would be good joke, only... Python has so many ugly web-frameworks, that this doesn't make any difference.
- telemachos 17y agoIf anyone liked the idea, but not as a joke, there is itty: http://github.com/toastdriven/itty/ http://github.com/toastdriven/itty/ It's a self-described "little-experiment" based on Sinatra.