Updated: (MODPYTHON-220) In PSP pages, 'import' doesn't map
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > Apache Mod-Python > Updated: (MODPYTHON-220) In PSP pages, 'import' doesn't map




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Updated: (MODPYTHON-220) In PSP pages, 'import' doesn't map  
Graham Dumpleton (JIRA)


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-22-07 06:13 AM


[ https://issues.apache.org/jira/brow...ls:all-tabpanel ]

Graham Dumpleton updated MODPYTHON-220:
---------------------------------------

Attachment: MP220-20070622-1-grahamd.diff

Attached patch MP220-20070622-1-grahamd.diff which fixes this problem.

> In PSP pages, 'import' doesn't map through to apache.import_module().
> ---------------------------------------------------------------------
>
>                 Key: MODPYTHON-220
>                 URL: https://issues.apache.org/jira/browse/MODPYTHON-220
>             Project: mod_python
>          Issue Type: Improvement
>          Components: psp
>    Affects Versions: 3.3.1
>            Reporter: Graham Dumpleton
>         Attachments: MP220-20070622-1-grahamd.diff
>
>
> When Python code appears in SSI files, a trick is performed such that the Python c
ode in the SSI files is seen as having been originally imported using the new module
 importer. This means that if 'import' is used with the Python code, it will map thr
oug
h to apache.import_module() and first use that mechanism to try and import code modules. Thi
s trick is not performed for PSP pages however.
> What needs to be done for PSP pages is the equivalent of the SSI trick:
>             class _InstanceInfo:
>                 def __init__(self, label, file, cache):
>                     self.label = label
>                     self.file = file
>                     self.cache = cache
>                     self.children = {}
>             filter.req.ssi_globals["__file__"] = filter.req.filename
>             filter.req.ssi_globals["__mp_info__"] = _InstanceInfo(
>                     None, filter.req.filename, None)
>             filter.req.ssi_globals["__mp_path__"] = []
> What this is doing is setting up in the environment of the SSI code object
 the magic variables that 'import' hook looks for to allow it to map to apac
he.import_module().
> If same done in PSP pages then 'import' will map to apache.import_module() for PSP
 pages also as first step.






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 03:04 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register