#2426: Exception when importing turbogears with python -OO
-------------------------+--------------------------------------------------
 Reporter:  nickpholden  |        Owner:                  
     Type:  defect       |       Status:  new             
 Priority:  low          |    Milestone:  __unclassified__
Component:  TurboGears   |      Version:  1.1             
 Severity:  normal       |   Resolution:                  
 Keywords:               |  
-------------------------+--------------------------------------------------
Comment (by jorge.vargas):

 This is not a TG bug but a problem with a trick Peak pulls to build a
 docstring on the fly (which doesn't exists with -OO) hence the NoneType
 error.

 The offending coded is the second to last line of the follow snipped.

 {{{
     def wrap(__func):
         '''
         try:
             lock = $self.__lock__
         except AttributeError:
             try:
                 from threading import RLock
             except ImportError:
                 from dummy_threading import RLock
             lock = $self.__dict__.setdefault('__lock__',RLock())
         lock.acquire()
         try:
             return __func($args)
         finally:
             lock.release()'''
     from inspect import getargspec
     first_arg = getargspec(func)[0][0]
     wrap.__doc__ = wrap.__doc__.replace('$self', first_arg)
     return apply_template(wrap, func)
 }}}

 Also note this will affect TG2.0 and earlier but not TG2.1 but I'm not
 sure what to do with it. I'm going to report it upstream and if pje
 decided to fix it then we can upgrade otherwise I guess we can't just run
 TG with -OO

-- 
Ticket URL: <http://trac.turbogears.org/ticket/2426#comment:1>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development

-- 
You received this message because you are subscribed to the Google
Groups "TurboGears Tickets" group.
This group is read-only. No posting by normal members allowed.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets?hl=en?hl=en

Reply via email to