Changeset 2534 for package_branches


Ignore:
Timestamp:
Oct 29, 2009, 3:27:33 AM (15 years ago)
Author:
quentin
Message:

Document MachineView?.getattr

File:
1 edited

Legend:

Unmodified
Added
Removed
  • package_branches/invirt-web/cherrypy/code/main.py

    r2530 r2534  
    254254
    255255    class MachineView(View):
    256         # This is hairy. Fix when CherryPy 3.2 is out. (rename to
    257         # _cp_dispatch, and parse the argument as a list instead of
    258         # string
    259 
    260256        def __getattr__(self, name):
     257            """Synthesize attributes to allow RESTful URLs like
     258            /machine/13/info. This is hairy. CherryPy 3.2 adds a
     259            method called _cp_dispatch that allows you to explicitly
     260            handle URLs that can't be mapped, and it allows you to
     261            rewrite the path components and continue processing.
     262
     263            This function gets the next path component being resolved
     264            as a string. _cp_dispatch will get an array of strings
     265            representing any subsequent path components as well."""
     266
    261267            try:
    262268                cherrypy.request.params['machine_id'] = int(name)
Note: See TracChangeset for help on using the changeset viewer.