emmett-framework / emmett

The web framework for inventors
BSD 3-Clause "New" or "Revised" License
1.06k stars 71 forks source link

problem with Expose.build_name() #83

Closed juniverse76 closed 8 years ago

juniverse76 commented 8 years ago

Hello @gi0baro,

This is my first time ever to write issue in github, so please forgive me if I write this in a wrong place. That being said,

I found what seems to be a problem in url system. I followed your example (bloggy) and it keeps spitting error, and the problem I found was in Expose.build_name(). In the function, I believe it is supposed to make short name of python file name, however, it only results 'py' as the name (which is just an extension) Thus, Expose.routes_out list which has list of exposed 'methods' in the python file, but all has 'py.index', 'py.one', and so on, not 'microblog.index' and 'microblog.one'. (I changed my bloggy.py file name to microblog.py)

Going deeper, when parsing file name in Expose.build_name() function, it uses 'self.folder' as guide to cut the file name, but it points to 'templates' path, but the python file is in the parent folder. so if the python file name is shorter than 'templates' (9 length), it would not create problem because the next line which checks for None. Otherwise, I believe it will create problem building Expose.routes_out list.

I hope I presented my idea well enough.

gi0baro commented 8 years ago

@juniverse76 No problem at all, I will inspect this shortly.

gi0baro commented 8 years ago

@juniverse76 You're right, this is a bug. I'm quite disappointed I haven't noticed this before. Thank you for the catch, will fix this asap.

juniverse76 commented 8 years ago

@gi0baro Glad I can be helpful.

gi0baro commented 8 years ago

This is fixed on the current master. Probably will publish a 0.5.5 release too with the fix.