Hope it does not break anything else.

On Wednesday, 6 February 2013 13:18:51 UTC-6, Álvaro José Iradier wrote:
>
> Works, but the identation at the "else:" on line 84 in custom_import.py is 
> wrong. FIxed identation, and it apparently works perfect. 
>
> Thanks very much!
>
>
> On Wed, Feb 6, 2013 at 6:35 PM, Massimo Di Pierro 
> <massimo....@gmail.com<javascript:>
> > wrote:
>
>> I agree. I am have attempted a fix. Can you try it?
>>
>>
>> On Wednesday, 6 February 2013 01:23:06 UTC-6, Álvaro José Iradier wrote:
>>
>>> I agree they should get priority over system wide modules, but not over 
>>> imports for files on the same directory. So in Geraldo reports, it does not 
>>> make sense that in the situation:
>>>
>>> .../site-packages/geraldo/**generators/__init__.py -> from pdf import 
>>> PDFGenerator
>>> .../site-packages/geraldo/**geraldo/generators/pdf.py -> PDFGenerator 
>>> class is in here
>>> .../myapp/modules/pdf.py -> Nothing to do with Geraldo
>>>
>>> the pdf.py from modules/ is higher priority than the pdf.py from the 
>>> geraldo.generators package, when being imported from __init__.py in the 
>>> same folder.
>>>
>>> This behavior could unexpectedly break any module or package just 
>>> because the application uses a modules/whatever.py file, "whatever" being 
>>>  the same name as any other package. Furthermore, in this case the error 
>>> when importing geraldo.generators was something like "Can not import module 
>>> geraldo", which is quite misleading, and it took me some work to figure out 
>>> what was wrong.
>>>
>>> Maybe the rule should apply when importing from the web2py application, 
>>> or using local_import, but never when importing from other module files 
>>> where a simple filename collision inside any package can break the module.
>>>
>>> Thanks.
>>>
>>> On Tue, Feb 5, 2013 at 11:24 PM, Massimo Di Pierro <
>>> massimo....@gmail.com> wrote:
>>>
>>>> The rule is that if something is imported web2py should first look in 
>>>> app/modules/ because app-level modules should get priority else you cannot 
>>>> override system wide modules. So 2.3.2 is doing the right thing. This did 
>>>> not work well in previous versions.
>>>>  
>>>>
>>>> On Tuesday, 5 February 2013 14:40:41 UTC-6, Álvaro José Iradier wrote:
>>>>>
>>>>> Recently I updated web2py from 1.99.4 to 2.3.2. Suddenly, a PDF report 
>>>>> stopped working.
>>>>>
>>>>> Digging into the problem, I found there is a *pdf.py* file in my 
>>>>> application *modules/* folder. Also, I am using Geraldo Reports in *
>>>>> web2py/site-packages*.
>>>>>
>>>>> Geraldo reports has the following file: *geraldo/generators/pdf.py*
>>>>> and the __init__.py in geraldo/generators/__init__.py does:
>>>>>
>>>>> from pdf import PDFGenerator
>>>>>
>>>>>
>>>>> but when doing *import geraldo.generators*, that line fails, so 
>>>>> importing geraldo.generators fails. It fails in 2.3.2, but works in 
>>>>> 1.99.4.
>>>>>
>>>>> The fix has been to rename modules/pdf.py in my application to 
>>>>> modules/pdfreport.py, because it looks like web2py is trying to import it 
>>>>> in the geraldo/generators/__init.py sentence. ¿Is this the expected 
>>>>> behavior, or should it look in the __init__,py folder first, as it did in 
>>>>> 1.99.4?
>>>>>
>>>>> Thanks.
>>>>>
>>>>  -- 
>>>>  
>>>> --- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "web2py-users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to web2py+un...@**googlegroups.com.
>>>>
>>>> For more options, visit 
>>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>>> .
>>>>  
>>>>  
>>>>
>>>
>>>
>>>
>>> -- 
>>> (:============================**=====:)
>>>  Alvaro J. Iradier Muro - aira...@gmail.com 
>>>
>>  -- 
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>
>
> -- 
> (:=================================:)
>  Alvaro J. Iradier Muro - aira...@gmail.com <javascript:> 
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to