Commits

Remi Delon  committed 2930627

Added cpg.request.mustBeExposed

  • Participants
  • Parent commits 7309ee9

Comments (0)

Files changed (2)

File ChangeLog.txt

+	* Added cpg.request.mustBeExposed to allow filters to disable the .exposed check
 	* Allowed default session functions to be accessed by other modules -
 	ticket #56 (Remi)
     * Added cpg.threadData - ticket #53 (Remi)

File cherrypy/_cphttptools.py

     cpg.request.base = "http://" + cpg.request.headerMap['Host']
     cpg.request.browserUrl = cpg.request.base + cpg.request.browserUrl
     cpg.request.isStatic = False
+    cpg.request.mustBeExposed = True
     cpg.request.parsePostData = True
     cpg.request.rfile = rfile
 
     #   root.default('a', 'b', arg='val')
 
     # Also, we ignore trailing slashes
-    # Also, a method has to have ".exposed = True" in order to be exposed
+    # Also, a method has to have ".exposed == True" in order to be exposed
+    #   unless cpg.request.mustBeExposed == False
 
     path = cpg.request.path
     if path.startswith('/'): path = path[1:] # Remove leading slash
     virtualPathList = []
     while objectPathList:
         candidate = getObjFromPath(objectPathList, objCache)
-        if callable(candidate) and getattr(candidate, 'exposed', False):
+        if callable(candidate) and (
+                (not cpg.request.mustBeExposed) or
+                getattr(candidate, 'exposed', False)):
             foundIt = True
             break
         # Couldn't find the object: pop one from the list and try "default"
             virtualPathList.insert(0, lastObj)
             objectPathList.append('default')
             candidate = getObjFromPath(objectPathList, objCache)
-            if callable(candidate) and getattr(candidate, 'exposed', False):
+            if callable(candidate) and (
+                    (not cpg.request.mustBeExposed) or
+                    getattr(candidate, 'exposed', False)):
                 foundIt = True
                 isDefault = True
                 break