Anonymous avatar Anonymous committed 2930627

Added cpg.request.mustBeExposed

Comments (0)

Files changed (2)

+	* 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)

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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.