If you're just going to redirect if access control fails, then you should be able to use the require functions: require_group( group/ groups ), require_identity(), require_permission( permission/ permissions ), and require_host( host/hosts ).

However, because they raise exceptions, some sort of wrapper will be necessary. Possibly some code in turbogears.expose... I'll look at that this week...

Of course, if your access control is static, you should take advantage of the require decorator:

@turbogears.expose( content_type="image/jpeg" )
@identity.require( permission=["view-images","edit-images"] )
    img = ('/home/jared/images/%s' % img)
    f = open(img, 'r')
    return f.read()


On 1 Nov, 2005, at 7:05 pm, SuperJared wrote:

@turbogears.expose()
@mimetype('image/jpeg')
def imgsrv(self, img):
    if '''Add validation routines here'''
        img = ('/home/jared/images/%s' % img)
        f = open(img, 'r')
        return f.read()
    else:
        '''Redirect when validation fails'''

--
Jeff Watkins
http://metrocat.org/

"Not everything that can be counted counts, and not everything that counts can be counted."
-- Albert Einstein

Reply via email to