List Info

Thread: Upgrade to 2.2 - static problems




Upgrade to 2.2 - static problems
user name
2006-04-11 15:53:41
Hello,

> Can you post some sample code demonstrating the problem
? It's hard
> to tell what's happening without seeing your code and
configuration.

Relevant sections of my config file and code are included
below.

Also, having used my app for actual work today (after having
been
avoiding it), I noticed a new problem.  I don't know if it
is related
or not.  Every time I raise a HTTPredirect, for example:

"""
raise cherrypy.HTTPRedirect("/settings/")
"""

I am taken to a page that says something like this, rather
than to
the intended target as happened before the upgrade:

"""
This resource resides temporarily at http://localhost:808
0/settings/.
"""

config file:

"""
[global]
static_filter.root =
"n:/sfsu/tools/python/russell"

[/resources]
static_filter.on = True
static_filter.dir = "resources"
"""

code:

"""    
<snip imports>

class Russell:

    _cp_filters =
[httpauthfilter.HttpAuthFilter(cppasswordPath='.rcppass',
                     realm='localhost',
privateKey='quack!', 
                     unauthorizedPath='/unauthorized')]

    def __init__(self):
        #Add each class holding app sections to the root
from their
modules
        self.Analysis = analysis.Analysis()
        self.FuturePayments =
futurepayments.FuturePayments()   
        self.Pending = pending.Pending()
        self.NewApp = newapp.NewApp()
        #Create a kirbybase instance for retrival of
settings
        self.settings_db = kirbybase.KirbyBase()            
   

    def index(self):
        #Fetch the next Future Payment and Pending dates
from
settings.
        next_fp =
dateutil.parser.parse(self.settings_db.select(
                       
"n:/sfsu/tools/python/russell/resources/settings.tbl&
quot;,
                        ['name'],
['next_future_payment'])[0][2]).strftime(
                                                            
     
"%d/%m/%Y")
        next_pe =
dateutil.parser.parse(self.settings_db.select( 
                       
"n:/sfsu/tools/python/russell/resources/settings.tbl&
quot;,
                        ['name'],
['next_pending'])[0][2]).strftime(
                                                            
     
"%d/%m/%Y")
        #Render the index page.
        return cherrytemplate.renderTemplate(file=
                           
"n:/sfsu/tools/python/russell/html/index.html") 
 

    index.exposed = True

<snip other methods>

    def default(self, dir, *args, **kwargs):
        '''In case the user agent tried to trick us or is
faulty'''
        return "Bad request"
    
    default.exposed = True

    def unauthorized(self):
        '''Must be declared at the same level where you
defined the
filter'''
        return "You are not authorized to access that
page"
    
    unauthorized.exposed = True

cherrypy.root = Russell()

if __name__ == '__main__':
    cherrypy.config.update(file = 'russell.conf')
    cherrypy.server.start()
"""

Thank you for any help that you can offer.

Russell

The Duck Quacks:
http://www-users.
york.ac.uk/~rb502/ - Homepage
h
ttp://www-users.york.ac.uk/~rb502/blog/quack.shtml -
Blog
http://www.flic
kr.com/photos/lsnduck/ - Photos

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )