Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 926

Show
Ignore:
Timestamp:
01/12/06 12:42:46
Author:
rdelon
Message:

Proof of concept idea to handle multiple apps: adding a cherrypy.url() function and a is_app_root class attribute for apps

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/__init__.py

    r910 r926  
    44 
    55import datetime 
     6import os.path 
    67import sys 
    78import types 
     
    101102    logfunc(msg, context, severity) 
    102103 
     104def url(u): 
     105    return request.app_path + u 
  • trunk/cherrypy/_cphttptools.py

    r917 r926  
    270270        names = [name for name, candidate in objectTrail] 
    271271         
     272        # Try to get app_path: 
     273        current_objectpath = objectpath 
     274        for i in xrange(len(objectTrail) - 1, -1, -1): 
     275            name, candidate = objectTrail[i] 
     276            if getattr(candidate, 'is_app_root', False): 
     277                cherrypy.request.app_path = current_objectpath 
     278                break 
     279            current_objectpath = os.path.dirname(current_objectpath) 
     280 
    272281        # Try successive objects (reverse order) 
    273282        mounted_app_roots = cherrypy.tree.mount_points.values() 

Hosted by WebFaction

Log in as guest/cpguest to create tickets