Closed: (MODPYTHON-198) Python 2.5 nested auth functions in
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 > Closed: (MODPYTHON-198) Python 2.5 nested auth functions in




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

    Closed: (MODPYTHON-198) Python 2.5 nested auth functions in  
Graham Dumpleton (JIRA)


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


 
05-01-07 12:12 PM


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

Graham Dumpleton closed MODPYTHON-198.
--------------------------------------


> Python 2.5 nested auth functions in publisher.
> ----------------------------------------------
>
>                 Key: MODPYTHON-198
>                 URL: https://issues.apache.org/jira/browse/MODPYTHON-198
>             Project: mod_python
>          Issue Type: Bug
>          Components: publisher
>    Affects Versions: 3.2.10
>            Reporter: Graham Dumpleton
>         Assigned To: Graham Dumpleton
>             Fix For: 3.3
>
>
> Jim Gallacher wrote:
> With Python 2.5 I get 2 failures:
>     test_publisher_auth_nested
>     test_publisher_auth_method_nested
> It looks like something has changed in Python 2.5 introspection that is
> messing up publisher.
> Test script testme.py
> ---------------------
> def testfunc():
>      print 'stuff'
>      def __auth__():
>          print '__auth__ called'
>      def __access__():
>          print '__access__ called'
> def main():
>      func_obj = testfunc
>      func_code = func_obj.func_code
>      print func_code.co_names
> if __name__ == '__main__':
>      main()
> Results
> -------
> $ python2.3 testme.py
> ('__auth__', '__access__')
> $ python2.4 testme.py
> ('__auth__', '__access__')
> $ python2.5 testme.py
> ()
> Dan Eloff points out that information is now in co_varnames. 
> () 
> ('__auth__', '__access__') 
> 	d = 5
> 	def bar(c):
> 		return c 
> () 
> ('a', 'b', 'd', 'bar')
> To get just args, try: 
> ('a', 'b')
> And for just local vars: 
> ('d', 'bar')
> Still need to work out if actual code objects for the functions are availa
ble in co_consts or not. Ie., need to replace:
>         if "__auth__" in func_code.co_names:
>             i = list(func_code.co_names).index("__auth__")
>             __auth__ = func_code.co_consts[i+1]
>             if hasattr(__auth__, "co_name"):
>                 __auth__ = new.function(__auth__, func_globals)
>             found_auth = 1






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 10:25 AM.      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