Re: Re: Re: [web2py] Re: web2py 1.96.4 is OUT
On 11 June 2011 04:55, Pierre Thibault pierre.thibau...@gmail.com wrote: 2011/6/9 Pierre Thibault pierre.thibau...@gmail.com 2011/6/9 caleb.hatti...@gmail.com On , Anthony abasta...@gmail.com wrote: Do you have an app to reproduce the problem? I created an app named Castalia (note the capitalization) with a module /modules/selfgroup/castalia/config.py, which I think is the same structure and naming as Alessandro's app. In a controller action, I then did: from selfgroup.castalia import config and it seems to work fine, though I believe Alessandro was getting an import error at that point. But maybe I'm missing something. I think we should ask him to make a small test app for us that demonstrates the problem. Else we're guessing. Alessandro, can you send us the code having the unexpected behavior so the Windows guys can take a look? As I understand, you have to remove the capitalization to make it work because otherwise even if the capitalization match, it does not import properly. Right? -- OK, since we cannot reproduce the bug and we cannot know precisely what the bug is, we will consider the issue closed. Do you think there is something to add about this issue? I would agree with that. Anthony has tested the capitalization issue directly (it works), and I checked what happens on Windows with capitalized nested folders and import statements (they work if the capitalization is matched). I think we need a reproducible test case here.
Re: [web2py] Re: web2py 1.96.4 is OUT
2011/6/11 Alessandro Iob alessandro@gmail.com Hi Pierre, I'll send a test application to Anthony this weekend. I've experienced the same problem under OS X (with a case-insensitive file system) when I've changed the case from Castalia to castalia: web2py tried to include the controllers from old Castalia path and not from the new lowercase version. Obviously I've closed and restarted web2py before changing the application name. I think OS X has a filename cache of some kind. Alessandro OK, cool! I'll be the reference for questions on the code. If needed, you may write directly to my personal mail box. I don't follow everything on the web2py mailing list because there is too many messages so I may sometimes miss something. -- A+ - Pierre My blog and profile (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com YouTube page (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2
Re: [web2py] Re: web2py 1.96.4 is OUT
On 11 June 2011 11:42, Pierre Thibault pierre.thibau...@gmail.com wrote: 2011/6/11 Alessandro Iob alessandro@gmail.com Hi Pierre, I'll send a test application to Anthony this weekend. I've experienced the same problem under OS X (with a case-insensitive file system) when I've changed the case from Castalia to castalia: web2py tried to include the controllers from old Castalia path and not from the new lowercase version. Obviously I've closed and restarted web2py before changing the application name. I think OS X has a filename cache of some kind. Alessandro OK, cool! I'll be the reference for questions on the code. If needed, you may write directly to my personal mail box. I don't follow everything on the web2py mailing list because there is too many messages so I may sometimes miss something. Ok, I am going to make a strategic exit here. I think you guys will be able to solve it, now that we know what to look for, and will have a test case. I looked over the code in custom_import and I couldn't find anything wrong regarding casing. kind regards Caleb
Re: Re: Re: [web2py] Re: web2py 1.96.4 is OUT
2011/6/9 Pierre Thibault pierre.thibau...@gmail.com 2011/6/9 caleb.hatti...@gmail.com On , Anthony abasta...@gmail.com wrote: Do you have an app to reproduce the problem? I created an app named Castalia (note the capitalization) with a module /modules/selfgroup/castalia/config.py, which I think is the same structure and naming as Alessandro's app. In a controller action, I then did: from selfgroup.castalia import config and it seems to work fine, though I believe Alessandro was getting an import error at that point. But maybe I'm missing something. I think we should ask him to make a small test app for us that demonstrates the problem. Else we're guessing. Alessandro, can you send us the code having the unexpected behavior so the Windows guys can take a look? As I understand, you have to remove the capitalization to make it work because otherwise even if the capitalization match, it does not import properly. Right? -- OK, since we cannot reproduce the bug and we cannot know precisely what the bug is, we will consider the issue closed. Do you think there is something to add about this issue? -- A+ - Pierre My blog and profile (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com YouTube page (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2
Re: Re: [web2py] Re: web2py 1.96.4 is OUT
On , Pierre Thibault pierre.thibau...@gmail.com wrote: 2011/6/9 cjrh caleb.hatti...@gmail.com On Thursday, 9 June 2011 03:03:51 UTC+2, Massimo Di Pierro wrote:Users who have an opinion please share it now. This is important. Could you direct us to more details about the issue? My current understanding is shallow, but I agree with Pierre that platform-specific environment settings are very likely not the way to go here. I much prefer all cross-platform issues to be handled with the os and sub modules. Why can't we do that here? It seems we have no developer with Windows where is the problem. I am on Windows, still XP even. Is there a small zipped app that I could test quickly to see the problem?
Re: Re: [web2py] Re: web2py 1.96.4 is OUT
2011/6/9 caleb.hatti...@gmail.com On , Pierre Thibault pierre.thibau...@gmail.com wrote: 2011/6/9 cjrh caleb.hatti...@gmail.com On Thursday, 9 June 2011 03:03:51 UTC+2, Massimo Di Pierro wrote:Users who have an opinion please share it now. This is important. Could you direct us to more details about the issue?My current understanding is shallow, but I agree with Pierre that platform-specific environment settings are very likely not the way to go here. I much prefer all cross-platform issues to be handled with the os and sub modules. Why can't we do that here? It seems we have no developer with Windows where is the problem. I am on Windows, still XP even. Is there a small zipped app that I could test quickly to see the problem? Sure, if you can debug code. Get code from the Mercurial repository. Debug and submit the patch to Massimo. Look for the problem described by Alessandro. You'll find the information you need on the problem on the threads named web2py 1.96.*x* is OUT. It is probably a bug with the code I wrote but I don't have a Windows machine to debug a problem specific to this platform. -- A+ - Pierre My blog and profile (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com YouTube page (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2
Re: Re: [web2py] Re: web2py 1.96.4 is OUT
For anyone else following, the thread is herehttps://groups.google.com/d/topic/web2py/_zhjxWa4tAU/discussion. I am going to have a look at this.
Re: Re: [web2py] Re: web2py 1.96.4 is OUT
So you suggest removing the case insensitive flag that was added in 1.96.4?
Re: Re: [web2py] Re: web2py 1.96.4 is OUT
But in a web2py app, you would have something like /applications/Cast/modules/cast.py, and in your code you would just do 'import cast'. My understanding of the problem is that in that case, the new web2py importer tries to import applications.cast.modules.cast instead of applications.Cast.modules.cast, which results in an import error. In fact, I cannot actually reproduce that problem (Windows 7, Python 2.7, web2py 1.96.3) -- if I capitalize the name of the application folder, the web2py importer still appears to work. So, as far as I can tell, the importer works, even without the fix in trunk, though maybe I have misunderstood the problem. Anthony On Thursday, June 9, 2011 10:03:01 AM UTC-4, cjrh wrote: Ok, so here is the thing: it appears that on Windows, everything works if the capitalization of the import statement matches the capitalization of the folder structure. Consider this folder structure (and there is an __init__.py in each folder hierarchy): /app/Cast/inner/cast.py In my file /test_imp.py, these contents WORK: try: import app.Cast.inner.cast print 'Pass' except: print 'Fail' pass These contents FAIL: try: import app.cast.inner.cast print 'Pass' except: print 'Fail' pass If, however, I change the folder structure to this: /app/cast/inner/cast.py Then I get *exactly opposite results*. In other words, the capitalization of the import path in the python file and on the file system must exactly match. This is on Windows XP x64 SP2. I have attached my test. In my opinion, we should just document that the cast must match. Note that this issue has *nothing to do with web2py*, and as a Windows user, I am not too surprised by this behaviour anyway.
Re: Re: [web2py] Re: web2py 1.96.4 is OUT
On Thursday, 9 June 2011 16:03:01 UTC+2, cjrh wrote: In my opinion, we should just document that the cast must match. Note that this issue has *nothing to do with web2py*, and as a Windows user, I am not too surprised by this behaviour anyway. ...should just document that the *case *must match. (Sorry for any confusion)
Re: Re: Re: [web2py] Re: web2py 1.96.4 is OUT
On Thursday, June 9, 2011 10:18:41 AM UTC-4, cjrh wrote: On , Massimo Di Pierro massim...@gmail.com wrote: So you suggest removing the case insensitive flag that was added in 1.96.4? Yes. In Alessandro's specific case, he should use: import app.Castalia.blah.blah.castialia But shouldn't he be able to just do 'import castalia' and have it work (again, for me it actually does work on Windows, but assuming it doesn't work on some systems, shouldn't it be fixed)? Anthony
Re: Re: Re: Re: [web2py] Re: web2py 1.96.4 is OUT
On , Anthony abasta...@gmail.com wrote: On Thursday, June 9, 2011 10:18:41 AM UTC-4, cjrh wrote: On , Massimo Di Pierro massim...@gmail.com wrote: So you suggest removing the case insensitive flag that was added in 1.96.4? Yes. In Alessandro's specific case, he should use: import app.Castalia.blah.blah.castialia But shouldn't he be able to just do 'import castalia' and have it work (again, for me it actually does work on Windows, but assuming it doesn't work on some systems, shouldn't it be fixed)? The issue seems to appear only when there is a repeated name in the chain. Could you test that too? My attachment has such a test-case ready to run. It seems that when a name is not repeated, the case-insensitive name matching works. This smells like a bug in Python, and probably needs to be fixed there.
Re: Re: [web2py] Re: web2py 1.96.4 is OUT
On Thursday, 9 June 2011 16:22:10 UTC+2, Anthony wrote: importer still appears to work. So, as far as I can tell, the importer works, even without the fix in trunk, though maybe I have misunderstood the problem. Yes, it is confusing. The case-insensitivity works only until a name is repeated in the import chain. When that occurs, it fails.
Re: Re: [web2py] Re: web2py 1.96.4 is OUT
On Thursday, 9 June 2011 16:22:10 UTC+2, Anthony wrote: But in a web2py app, you would have something like /applications/Cast/modules/cast.py, and in your code you would just do 'import cast'. My understanding of the problem is that in that case, the new web2py importer tries to import applications.cast.modules.cast instead of applications.Cast.modules.cast, which results in an import error. Yes, this is a good point. I shall take a gander at Pierre's custom_import.py if I get some time later. I didn't realise the import path chain was being generated by web2py. That makes it our responsibility to fix.
Re: Re: [web2py] Re: web2py 1.96.4 is OUT
On Thursday, June 9, 2011 10:40:19 AM UTC-4, cjrh wrote: On Thursday, 9 June 2011 16:22:10 UTC+2, Anthony wrote: importer still appears to work. So, as far as I can tell, the importer works, even without the fix in trunk, though maybe I have misunderstood the problem. Yes, it is confusing. The case-insensitivity works only until a name is repeated in the import chain. When that occurs, it fails. Do you have an app to reproduce the problem? I created an app named Castalia (note the capitalization) with a module /modules/selfgroup/castalia/config.py, which I think is the same structure and naming as Alessandro's app. In a controller action, I then did: from selfgroup.castalia import config and it seems to work fine, though I believe Alessandro was getting an import error at that point. But maybe I'm missing something. Anthony
Re: Re: Re: [web2py] Re: web2py 1.96.4 is OUT
On , Anthony abasta...@gmail.com wrote: Do you have an app to reproduce the problem? I created an app named Castalia (note the capitalization) with a module /modules/selfgroup/castalia/config.py, which I think is the same structure and naming as Alessandro's app. In a controller action, I then did: from selfgroup.castalia import config and it seems to work fine, though I believe Alessandro was getting an import error at that point. But maybe I'm missing something. I think we should ask him to make a small test app for us that demonstrates the problem. Else we're guessing.
Re: Re: Re: [web2py] Re: web2py 1.96.4 is OUT
2011/6/9 caleb.hatti...@gmail.com On , Anthony abasta...@gmail.com wrote: Do you have an app to reproduce the problem? I created an app named Castalia (note the capitalization) with a module /modules/selfgroup/castalia/config.py, which I think is the same structure and naming as Alessandro's app. In a controller action, I then did: from selfgroup.castalia import config and it seems to work fine, though I believe Alessandro was getting an import error at that point. But maybe I'm missing something. I think we should ask him to make a small test app for us that demonstrates the problem. Else we're guessing. Alessandro, can you send us the code having the unexpected behavior so the Windows guys can take a look? As I understand, you have to remove the capitalization to make it work because otherwise even if the capitalization match, it does not import properly. Right? -- A+ - Pierre My blog and profile (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com YouTube page (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2
Re: [web2py] Re: web2py 1.96.4 is OUT
cjrh Thank you so much for this notice. I have not update web2py for very long coz it have a track record of breaking my production site apps :D. I will check out what breaks and what not. On Wed, Jun 8, 2011 at 12:53 PM, cjrh caleb.hatti...@gmail.com wrote: On Jun 7, 10:16 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: - explicitly closing all open files (should make it work in Pypy), thanks Caleb Just everyone, please note: that was a large change (80KB diff) affecting tiny parts of many files, so you should test your apps before immediately upgrading any production sites. After that patch, I already found one bug that I introduced in that patch, the fix for which is already included in 1.96.4, but there could be others. On the plus side, web2py on pypy appears to run fairly well. I haven't benchmarked or done any stress-testing yet (and I have seen some pypy funnies in my testing so far, but more like spurious, intermittent, lowel-level pypy errors) but I hope to do some of that soon.
Re: [web2py] Re: web2py 1.96.4 is OUT
And in the pypi? _ *Gilson Filho* *Web Developer http://gilsondev.com* 2011/6/8 ron_m ron.mco...@gmail.com My application is working with model files under a subdirectory == the controller name.
Re: [web2py] Re: web2py 1.96.4 is OUT
2011/6/7 Massimo Di Pierro massimo.dipie...@gmail.com I am not much of a windows user. I would like to understand what can go wrong with the solution in trunk? -- Is the solution in the trunk the one proposed by Alessandro: os.environ['PYTHONCASEOK'] = '1' ? Well, this solution is using a global change to fix for what is just probably just one bad line of code. This a good temporary solution but a bad long term solution. This is solution have the following flaws: - This solution may impact a lot of code; - Developers may experience unexpected behavior; - It makes it difficult to integrate web2py code with other code; The last flaw is very nasty. One example is web2py needing a special Python setting and another piece of code needing another setting. So each time execution switches from one source to another, the settings has to be restored properly. This may mean a big patch needs to be applied to make it work. This is the risk I see in this solution. And this problem is more probably related to a case insensitive file system than Windows itself. It may be only related to the file system type. This is why I suggested a ticket for a better fix later. A+ - Pierre My blog and profile (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com YouTube page (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2
Re: [web2py] Re: web2py 1.96.4 is OUT
On Jun 8, 2011, at 6:03 PM, Massimo Di Pierro wrote: Let me tink about this. This has relevant content: http://www.python.org/dev/peps/pep-0235/ Users who have an opinion please share it now. This is important. What's going on, exactly? My impression is that something is getting lowercased that shouldn't be. Is it not within web2py's control? On Jun 8, 7:45 pm, Pierre Thibault pierre.thibau...@gmail.com wrote: 2011/6/7 Massimo Di Pierro massimo.dipie...@gmail.com I am not much of a windows user. I would like to understand what can go wrong with the solution in trunk? -- Is the solution in the trunk the one proposed by Alessandro: os.environ['PYTHONCASEOK'] = '1' ? Well, this solution is using a global change to fix for what is just probably just one bad line of code. This a good temporary solution but a bad long term solution. This is solution have the following flaws: - This solution may impact a lot of code; - Developers may experience unexpected behavior; - It makes it difficult to integrate web2py code with other code; The last flaw is very nasty. One example is web2py needing a special Python setting and another piece of code needing another setting. So each time execution switches from one source to another, the settings has to be restored properly. This may mean a big patch needs to be applied to make it work. This is the risk I see in this solution. And this problem is more probably related to a case insensitive file system than Windows itself. It may be only related to the file system type. This is why I suggested a ticket for a better fix later. A+ - Pierre My blog and profile (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com YouTube page (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2
Re: [web2py] Re: web2py 1.96.4 is OUT
2011/6/8 Massimo Di Pierro massimo.dipie...@gmail.com Let me tink about this. This has relevant content: http://www.python.org/dev/peps/pep-0235/ Users who have an opinion please share it now. This is important. Thank you for the pointer. It seems there is a bug in the web2py code where we are losing the capitalization. The import on Windows should work just like if it was on Unix. The best thing would be to fix this bug but it has to be done on Windows so until then we can create a ticket. I suggest to remove the current fix in trunk because it is too awkward. Alessandro can use lower case letters until real fix done. I think it is the best solution for the moment. -- A+ - Pierre My blog and profile (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com YouTube page (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2
Re: [web2py] Re: web2py 1.96.4 is OUT
2011/6/8 Jonathan Lundell jlund...@pobox.com On Jun 8, 2011, at 6:03 PM, Massimo Di Pierro wrote: Let me tink about this. This has relevant content: http://www.python.org/dev/peps/pep-0235/ Users who have an opinion please share it now. This is important. What's going on, exactly? My impression is that something is getting lowercased that shouldn't be. Is it not within web2py's control? Yes, I think it is a bug somewhere in the patch that I submitted. -- A+ - Pierre My blog and profile (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com YouTube page (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2
Re: [web2py] Re: web2py 1.96.4 is OUT
The blocks are not working. layout.html (...) {{ block header }}{{end}} header.html {{ extend 'layout.html' }} {{ block header }} Header {{ end }} _ *Gilson Filho* *Web Developer http://gilsondev.com* 2011/6/8 Pierre Thibault pierre.thibau...@gmail.com 2011/6/8 Jonathan Lundell jlund...@pobox.com On Jun 8, 2011, at 6:03 PM, Massimo Di Pierro wrote: Let me tink about this. This has relevant content: http://www.python.org/dev/peps/pep-0235/ Users who have an opinion please share it now. This is important. What's going on, exactly? My impression is that something is getting lowercased that shouldn't be. Is it not within web2py's control? Yes, I think it is a bug somewhere in the patch that I submitted. -- A+ - Pierre My blog and profile (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com YouTube page (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2
Re: [web2py] Re: web2py 1.96.4 is OUT
On Jun 8, 2011, at 6:47 PM, Pierre Thibault wrote: 2011/6/8 Jonathan Lundell jlund...@pobox.com On Jun 8, 2011, at 6:03 PM, Massimo Di Pierro wrote: Let me tink about this. This has relevant content: http://www.python.org/dev/peps/pep-0235/ Users who have an opinion please share it now. This is important. What's going on, exactly? My impression is that something is getting lowercased that shouldn't be. Is it not within web2py's control? Yes, I think it is a bug somewhere in the patch that I submitted. Good; then we can fix it. As PEP-235 implies, it's a good idea to be case-preserving on case-insensitive filesystems.
Re: [web2py] Re: web2py 1.96.4 is OUT
good job, everyone, hope web2py improve day by day, thank you so much. \(^o^)/
Re: [web2py] Re: web2py 1.96.4 is OUT
2011/6/7 Massimo Di Pierro massimo.dipie...@gmail.com What do you propose? I do not like it very much either. On Jun 7, 3:33 pm, Pierre Thibault pierre.thibau...@gmail.com wrote: 2011/6/7 Massimo Di Pierro massimo.dipie...@gmail.com - auto import should work on windows (now on windows ignore will ignore case by default) I don't like this solution. -- A+ I guess it is a pragmatic solution until someone can edit and test the code under Windows. I suggest creating a ticket with low priority for doing this later as an improvement. A+ - Pierre My blog and profile (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com YouTube page (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2