botanicus / rango

Rango is ultralightweight, ultracustomizable, ultracool web framework inspired by Django.
http://101ideas.cz
MIT License
222 stars 9 forks source link

Use rack-conneg instead of our custom middleware for serving static files #88

Closed botanicus closed 14 years ago

botanicus commented 15 years ago

http://github.com/dkubb/rack-conneg

botanicus commented 14 years ago

Nice, but has it sense? Why is it better than the default in Rack? BTW it's using Pathname :/

dkubb commented 14 years ago

I'm curious to hear what the problem is with Pathname? It's far cleaner than passing around a file path as a String IMHO.

The rack-conneg gem wasn't meant to be used by frameworks so much. It was meant to sit directly on Rack, and provide a simple way to make static sites and use Content Negotation to retrieve the best matching file for the client. I suppose frameworks could use it, but that wasn't my intention.

botanicus commented 14 years ago

Hi Dan, yes, I realized that after I went through the code in more detail. About Pathname, it's definitely better than string, but I don't like it. I was trying to use it for some time but it didn't work for me very well so I get back to File & passing strings for now, even if I don't like it. However I don't remember exact reasons – I'll probably reconsider it soon, it might be useful for Rango.

dkubb commented 14 years ago

I agree that Pathname isn't perfect. For me it's better than String, but I'm still not happy with it. It would be nice to have an object that represents a path, but with a simpler interface than Pathname. It'd also be nice if to_s actually returned something that was usable, since alot of the File and IO methods call to_s on the input, and a common problem with Pathname is that when it's handed to those methods #to_s returns a String like "#Pathname:/tmp/test.rb". I think it'd be fine for #inspect to return that, but it would be nicer for #to_s to return '/tmp/test.rb'.

botanicus commented 14 years ago

You're right Dan, I already created issue about it http://github.com/botanicus/rango/issuesearch?state=open&q=pathname#issue/148

I wish to have something better, but on the other side rewriting pathname means to have problems with compatibility with other software etc ... :/