You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-dev@quetz.apache.org by "Graham Dumpleton (JIRA)" <ji...@apache.org> on 2005/12/18 11:43:34 UTC

[jira] Created: (MODPYTHON-101) If target handler found but evaluates false, there should still be an error if not silent.

If target handler found but evaluates false, there should still be an error if not silent.
------------------------------------------------------------------------------------------

         Key: MODPYTHON-101
         URL: http://issues.apache.org/jira/browse/MODPYTHON-101
     Project: mod_python
        Type: Bug
  Components: core  
    Versions: 3.2, 3.1.4    
    Reporter: Graham Dumpleton


If one specifies PythonHandler directive and the target is mistakenly set to be something like:

  handler = 0
  handler = None
  handler = False
  handler = []
  handler = {}

no error is raised.

As comparison, if one has:

  handler = 1

you get an error:

  Traceback (most recent call last):

    File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 309, in HandlerDispatch
      result = object(req)

  TypeError: 'int' object is not callable

This is because if the target in any way evaluates to false, no attempt is made to execute it, but at the same time if the silent flag is not set no error is raised either.

In the case of HandlerDispatch in apache.py, the code currently is:

                # find the object
                object = resolve_object(module, object_str,
                                        arg=req, silent=hlist.silent)
                    
                if object:
                    
                    # call the object

                    ....

                elif hlist.silent:
                    result = DECLINED
 
It would make more sense that if hlist.silent is not set, that the object, whatever it may be should be called. This would ensure that any error response is always generated when it can be.

Thus, instead of just:

                if object:

it should really be:

                if not hlist.silent or object:

In the case of ConnectionDispatch() and FilterDispatch(), because silent is fixed to "0" in those cases, there should not even be a check of whether object evaluates true, it should just be called regardless.

Thus instead of:

            if object:

                # call the object
                if config.has_key("PythonEnablePdb"):
                    result = pdb.runcall(object, conn)
                else:
                    result = object(conn)

it should just be:

            # call the object:
            if config.has_key("PythonEnablePdb"):
                result = pdb.runcall(object, conn)
            else:
                result = object(conn)

Indent level of following assertion clause should also be shifted out as well.




-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (MODPYTHON-101) If target handler found but evaluates false, there should still be an error if not silent.

Posted by "Graham Dumpleton (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/MODPYTHON-101?page=all ]

Graham Dumpleton updated MODPYTHON-101:
---------------------------------------

    Assign To: Graham Dumpleton

> If target handler found but evaluates false, there should still be an error if not silent.
> ------------------------------------------------------------------------------------------
>
>          Key: MODPYTHON-101
>          URL: http://issues.apache.org/jira/browse/MODPYTHON-101
>      Project: mod_python
>         Type: Bug
>   Components: core
>     Versions: 3.1.4, 3.2.7
>     Reporter: Graham Dumpleton
>     Assignee: Graham Dumpleton

>
> If one specifies PythonHandler directive and the target is mistakenly set to be something like:
>   handler = 0
>   handler = None
>   handler = False
>   handler = []
>   handler = {}
> no error is raised.
> As comparison, if one has:
>   handler = 1
> you get an error:
>   Traceback (most recent call last):
>     File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 309, in HandlerDispatch
>       result = object(req)
>   TypeError: 'int' object is not callable
> This is because if the target in any way evaluates to false, no attempt is made to execute it, but at the same time if the silent flag is not set no error is raised either.
> In the case of HandlerDispatch in apache.py, the code currently is:
>                 # find the object
>                 object = resolve_object(module, object_str,
>                                         arg=req, silent=hlist.silent)
>                     
>                 if object:
>                     
>                     # call the object
>                     ....
>                 elif hlist.silent:
>                     result = DECLINED
>  
> It would make more sense that if hlist.silent is not set, that the object, whatever it may be should be called. This would ensure that any error response is always generated when it can be.
> Thus, instead of just:
>                 if object:
> it should really be:
>                 if not hlist.silent or object:
> In the case of ConnectionDispatch() and FilterDispatch(), because silent is fixed to "0" in those cases, there should not even be a check of whether object evaluates true, it should just be called regardless.
> Thus instead of:
>             if object:
>                 # call the object
>                 if config.has_key("PythonEnablePdb"):
>                     result = pdb.runcall(object, conn)
>                 else:
>                     result = object(conn)
> it should just be:
>             # call the object:
>             if config.has_key("PythonEnablePdb"):
>                 result = pdb.runcall(object, conn)
>             else:
>                 result = object(conn)
> Indent level of following assertion clause in case of ConnectionDispatch() and call to filter.flush() in FilterDispatcher() should also be shifted out as well as appropriate.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (MODPYTHON-101) If target handler found but evaluates false, there should still be an error if not silent.

Posted by "Graham Dumpleton (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/MODPYTHON-101?page=all ]
     
Graham Dumpleton resolved MODPYTHON-101:
----------------------------------------

    Fix Version: 3.3
     Resolution: Fixed

> If target handler found but evaluates false, there should still be an error if not silent.
> ------------------------------------------------------------------------------------------
>
>          Key: MODPYTHON-101
>          URL: http://issues.apache.org/jira/browse/MODPYTHON-101
>      Project: mod_python
>         Type: Bug

>   Components: core
>     Versions: 3.2.7, 3.1.4
>     Reporter: Graham Dumpleton
>     Assignee: Graham Dumpleton
>      Fix For: 3.3

>
> If one specifies PythonHandler directive and the target is mistakenly set to be something like:
>   handler = 0
>   handler = None
>   handler = False
>   handler = []
>   handler = {}
> no error is raised.
> As comparison, if one has:
>   handler = 1
> you get an error:
>   Traceback (most recent call last):
>     File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 309, in HandlerDispatch
>       result = object(req)
>   TypeError: 'int' object is not callable
> This is because if the target in any way evaluates to false, no attempt is made to execute it, but at the same time if the silent flag is not set no error is raised either.
> In the case of HandlerDispatch in apache.py, the code currently is:
>                 # find the object
>                 object = resolve_object(module, object_str,
>                                         arg=req, silent=hlist.silent)
>                     
>                 if object:
>                     
>                     # call the object
>                     ....
>                 elif hlist.silent:
>                     result = DECLINED
>  
> It would make more sense that if hlist.silent is not set, that the object, whatever it may be should be called. This would ensure that any error response is always generated when it can be.
> Thus, instead of just:
>                 if object:
> it should really be:
>                 if not hlist.silent or object:
> In the case of ConnectionDispatch() and FilterDispatch(), because silent is fixed to "0" in those cases, there should not even be a check of whether object evaluates true, it should just be called regardless.
> Thus instead of:
>             if object:
>                 # call the object
>                 if config.has_key("PythonEnablePdb"):
>                     result = pdb.runcall(object, conn)
>                 else:
>                     result = object(conn)
> it should just be:
>             # call the object:
>             if config.has_key("PythonEnablePdb"):
>                 result = pdb.runcall(object, conn)
>             else:
>                 result = object(conn)
> Indent level of following assertion clause in case of ConnectionDispatch() and call to filter.flush() in FilterDispatcher() should also be shifted out as well as appropriate.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Work started: (MODPYTHON-101) If target handler found but evaluates false, there should still be an error if not silent.

Posted by "Graham Dumpleton (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/MODPYTHON-101?page=all ]
     
Work on MODPYTHON-101 started by Graham Dumpleton

> If target handler found but evaluates false, there should still be an error if not silent.
> ------------------------------------------------------------------------------------------
>
>          Key: MODPYTHON-101
>          URL: http://issues.apache.org/jira/browse/MODPYTHON-101
>      Project: mod_python
>         Type: Bug
>   Components: core
>     Versions: 3.1.4, 3.2.7
>     Reporter: Graham Dumpleton
>     Assignee: Graham Dumpleton

>
> If one specifies PythonHandler directive and the target is mistakenly set to be something like:
>   handler = 0
>   handler = None
>   handler = False
>   handler = []
>   handler = {}
> no error is raised.
> As comparison, if one has:
>   handler = 1
> you get an error:
>   Traceback (most recent call last):
>     File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 309, in HandlerDispatch
>       result = object(req)
>   TypeError: 'int' object is not callable
> This is because if the target in any way evaluates to false, no attempt is made to execute it, but at the same time if the silent flag is not set no error is raised either.
> In the case of HandlerDispatch in apache.py, the code currently is:
>                 # find the object
>                 object = resolve_object(module, object_str,
>                                         arg=req, silent=hlist.silent)
>                     
>                 if object:
>                     
>                     # call the object
>                     ....
>                 elif hlist.silent:
>                     result = DECLINED
>  
> It would make more sense that if hlist.silent is not set, that the object, whatever it may be should be called. This would ensure that any error response is always generated when it can be.
> Thus, instead of just:
>                 if object:
> it should really be:
>                 if not hlist.silent or object:
> In the case of ConnectionDispatch() and FilterDispatch(), because silent is fixed to "0" in those cases, there should not even be a check of whether object evaluates true, it should just be called regardless.
> Thus instead of:
>             if object:
>                 # call the object
>                 if config.has_key("PythonEnablePdb"):
>                     result = pdb.runcall(object, conn)
>                 else:
>                     result = object(conn)
> it should just be:
>             # call the object:
>             if config.has_key("PythonEnablePdb"):
>                 result = pdb.runcall(object, conn)
>             else:
>                 result = object(conn)
> Indent level of following assertion clause in case of ConnectionDispatch() and call to filter.flush() in FilterDispatcher() should also be shifted out as well as appropriate.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (MODPYTHON-101) If target handler found but evaluates false, there should still be an error if not silent.

Posted by "Graham Dumpleton (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/MODPYTHON-101?page=all ]

Graham Dumpleton updated MODPYTHON-101:
---------------------------------------

    Description: 
If one specifies PythonHandler directive and the target is mistakenly set to be something like:

  handler = 0
  handler = None
  handler = False
  handler = []
  handler = {}

no error is raised.

As comparison, if one has:

  handler = 1

you get an error:

  Traceback (most recent call last):

    File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 309, in HandlerDispatch
      result = object(req)

  TypeError: 'int' object is not callable

This is because if the target in any way evaluates to false, no attempt is made to execute it, but at the same time if the silent flag is not set no error is raised either.

In the case of HandlerDispatch in apache.py, the code currently is:

                # find the object
                object = resolve_object(module, object_str,
                                        arg=req, silent=hlist.silent)
                    
                if object:
                    
                    # call the object

                    ....

                elif hlist.silent:
                    result = DECLINED
 
It would make more sense that if hlist.silent is not set, that the object, whatever it may be should be called. This would ensure that any error response is always generated when it can be.

Thus, instead of just:

                if object:

it should really be:

                if not hlist.silent or object:

In the case of ConnectionDispatch() and FilterDispatch(), because silent is fixed to "0" in those cases, there should not even be a check of whether object evaluates true, it should just be called regardless.

Thus instead of:

            if object:

                # call the object
                if config.has_key("PythonEnablePdb"):
                    result = pdb.runcall(object, conn)
                else:
                    result = object(conn)

it should just be:

            # call the object:
            if config.has_key("PythonEnablePdb"):
                result = pdb.runcall(object, conn)
            else:
                result = object(conn)

Indent level of following assertion clause in case of ConnectionDispatch() and call to filter.flush() in FilterDispatcher() should also be shifted out as well as appropriate.




  was:
If one specifies PythonHandler directive and the target is mistakenly set to be something like:

  handler = 0
  handler = None
  handler = False
  handler = []
  handler = {}

no error is raised.

As comparison, if one has:

  handler = 1

you get an error:

  Traceback (most recent call last):

    File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 309, in HandlerDispatch
      result = object(req)

  TypeError: 'int' object is not callable

This is because if the target in any way evaluates to false, no attempt is made to execute it, but at the same time if the silent flag is not set no error is raised either.

In the case of HandlerDispatch in apache.py, the code currently is:

                # find the object
                object = resolve_object(module, object_str,
                                        arg=req, silent=hlist.silent)
                    
                if object:
                    
                    # call the object

                    ....

                elif hlist.silent:
                    result = DECLINED
 
It would make more sense that if hlist.silent is not set, that the object, whatever it may be should be called. This would ensure that any error response is always generated when it can be.

Thus, instead of just:

                if object:

it should really be:

                if not hlist.silent or object:

In the case of ConnectionDispatch() and FilterDispatch(), because silent is fixed to "0" in those cases, there should not even be a check of whether object evaluates true, it should just be called regardless.

Thus instead of:

            if object:

                # call the object
                if config.has_key("PythonEnablePdb"):
                    result = pdb.runcall(object, conn)
                else:
                    result = object(conn)

it should just be:

            # call the object:
            if config.has_key("PythonEnablePdb"):
                result = pdb.runcall(object, conn)
            else:
                result = object(conn)

Indent level of following assertion clause should also be shifted out as well.





> If target handler found but evaluates false, there should still be an error if not silent.
> ------------------------------------------------------------------------------------------
>
>          Key: MODPYTHON-101
>          URL: http://issues.apache.org/jira/browse/MODPYTHON-101
>      Project: mod_python
>         Type: Bug
>   Components: core
>     Versions: 3.2, 3.1.4
>     Reporter: Graham Dumpleton

>
> If one specifies PythonHandler directive and the target is mistakenly set to be something like:
>   handler = 0
>   handler = None
>   handler = False
>   handler = []
>   handler = {}
> no error is raised.
> As comparison, if one has:
>   handler = 1
> you get an error:
>   Traceback (most recent call last):
>     File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 309, in HandlerDispatch
>       result = object(req)
>   TypeError: 'int' object is not callable
> This is because if the target in any way evaluates to false, no attempt is made to execute it, but at the same time if the silent flag is not set no error is raised either.
> In the case of HandlerDispatch in apache.py, the code currently is:
>                 # find the object
>                 object = resolve_object(module, object_str,
>                                         arg=req, silent=hlist.silent)
>                     
>                 if object:
>                     
>                     # call the object
>                     ....
>                 elif hlist.silent:
>                     result = DECLINED
>  
> It would make more sense that if hlist.silent is not set, that the object, whatever it may be should be called. This would ensure that any error response is always generated when it can be.
> Thus, instead of just:
>                 if object:
> it should really be:
>                 if not hlist.silent or object:
> In the case of ConnectionDispatch() and FilterDispatch(), because silent is fixed to "0" in those cases, there should not even be a check of whether object evaluates true, it should just be called regardless.
> Thus instead of:
>             if object:
>                 # call the object
>                 if config.has_key("PythonEnablePdb"):
>                     result = pdb.runcall(object, conn)
>                 else:
>                     result = object(conn)
> it should just be:
>             # call the object:
>             if config.has_key("PythonEnablePdb"):
>                 result = pdb.runcall(object, conn)
>             else:
>                 result = object(conn)
> Indent level of following assertion clause in case of ConnectionDispatch() and call to filter.flush() in FilterDispatcher() should also be shifted out as well as appropriate.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (MODPYTHON-101) If target handler found but evaluates false, there should still be an error if not silent.

Posted by "Graham Dumpleton (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/MODPYTHON-101?page=comments#action_12360713 ] 

Graham Dumpleton commented on MODPYTHON-101:
--------------------------------------------

Whoops, to be as precise as possible, instead of the suggested:

                if not hlist.silent or object: 

it should be:

                if not hlist.silent or object is not None:

The only case this wouldn't then pick up is if PythonHandlerModule directive was used and the target handler attribute was specified, but was None. This can't be distinguished because resolve_object() returns None when silent is set and target couldn't be found. We can probably live with that. :-)

> If target handler found but evaluates false, there should still be an error if not silent.
> ------------------------------------------------------------------------------------------
>
>          Key: MODPYTHON-101
>          URL: http://issues.apache.org/jira/browse/MODPYTHON-101
>      Project: mod_python
>         Type: Bug
>   Components: core
>     Versions: 3.2, 3.1.4
>     Reporter: Graham Dumpleton

>
> If one specifies PythonHandler directive and the target is mistakenly set to be something like:
>   handler = 0
>   handler = None
>   handler = False
>   handler = []
>   handler = {}
> no error is raised.
> As comparison, if one has:
>   handler = 1
> you get an error:
>   Traceback (most recent call last):
>     File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 309, in HandlerDispatch
>       result = object(req)
>   TypeError: 'int' object is not callable
> This is because if the target in any way evaluates to false, no attempt is made to execute it, but at the same time if the silent flag is not set no error is raised either.
> In the case of HandlerDispatch in apache.py, the code currently is:
>                 # find the object
>                 object = resolve_object(module, object_str,
>                                         arg=req, silent=hlist.silent)
>                     
>                 if object:
>                     
>                     # call the object
>                     ....
>                 elif hlist.silent:
>                     result = DECLINED
>  
> It would make more sense that if hlist.silent is not set, that the object, whatever it may be should be called. This would ensure that any error response is always generated when it can be.
> Thus, instead of just:
>                 if object:
> it should really be:
>                 if not hlist.silent or object:
> In the case of ConnectionDispatch() and FilterDispatch(), because silent is fixed to "0" in those cases, there should not even be a check of whether object evaluates true, it should just be called regardless.
> Thus instead of:
>             if object:
>                 # call the object
>                 if config.has_key("PythonEnablePdb"):
>                     result = pdb.runcall(object, conn)
>                 else:
>                     result = object(conn)
> it should just be:
>             # call the object:
>             if config.has_key("PythonEnablePdb"):
>                 result = pdb.runcall(object, conn)
>             else:
>                 result = object(conn)
> Indent level of following assertion clause in case of ConnectionDispatch() and call to filter.flush() in FilterDispatcher() should also be shifted out as well as appropriate.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (MODPYTHON-101) If target handler found but evaluates false, there should still be an error if not silent.

Posted by "Graham Dumpleton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MODPYTHON-101?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Graham Dumpleton closed MODPYTHON-101.
--------------------------------------


> If target handler found but evaluates false, there should still be an error if not silent.
> ------------------------------------------------------------------------------------------
>
>                 Key: MODPYTHON-101
>                 URL: https://issues.apache.org/jira/browse/MODPYTHON-101
>             Project: mod_python
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.1.4, 3.2.7
>            Reporter: Graham Dumpleton
>         Assigned To: Graham Dumpleton
>             Fix For: 3.3
>
>
> If one specifies PythonHandler directive and the target is mistakenly set to be something like:
>   handler = 0
>   handler = None
>   handler = False
>   handler = []
>   handler = {}
> no error is raised.
> As comparison, if one has:
>   handler = 1
> you get an error:
>   Traceback (most recent call last):
>     File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 309, in HandlerDispatch
>       result = object(req)
>   TypeError: 'int' object is not callable
> This is because if the target in any way evaluates to false, no attempt is made to execute it, but at the same time if the silent flag is not set no error is raised either.
> In the case of HandlerDispatch in apache.py, the code currently is:
>                 # find the object
>                 object = resolve_object(module, object_str,
>                                         arg=req, silent=hlist.silent)
>                     
>                 if object:
>                     
>                     # call the object
>                     ....
>                 elif hlist.silent:
>                     result = DECLINED
>  
> It would make more sense that if hlist.silent is not set, that the object, whatever it may be should be called. This would ensure that any error response is always generated when it can be.
> Thus, instead of just:
>                 if object:
> it should really be:
>                 if not hlist.silent or object:
> In the case of ConnectionDispatch() and FilterDispatch(), because silent is fixed to "0" in those cases, there should not even be a check of whether object evaluates true, it should just be called regardless.
> Thus instead of:
>             if object:
>                 # call the object
>                 if config.has_key("PythonEnablePdb"):
>                     result = pdb.runcall(object, conn)
>                 else:
>                     result = object(conn)
> it should just be:
>             # call the object:
>             if config.has_key("PythonEnablePdb"):
>                 result = pdb.runcall(object, conn)
>             else:
>                 result = object(conn)
> Indent level of following assertion clause in case of ConnectionDispatch() and call to filter.flush() in FilterDispatcher() should also be shifted out as well as appropriate.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.