1

I ask you to help me finding the source of problems with the following code. I used page http://jcalderone.livejournal.com/53074.html as a guide. The only difference of my code is that resource isn't served from .rpy file. Also there is no cache() call anywhere.

The result of opening page at https://serveraddr:serverport/services/admin is 403 Forbidden. It needs to show the output from UpdateManager.render_GET().

In server.tac:

...

root = resource.ForbiddenResource()
err = resource.ForbiddenResource()
root.putChild("service", err)
upd = UpdateXMLProcessor()
err.putChild("update2", upd)

portal = Portal(PublicHTMLRealm(), [FilePasswordDB('httpd.password')])
credentialFactory = DigestCredentialFactory("md5", "House of Life Updates")
admin = HTTPAuthSessionWrapper(portal, [credentialFactory])
err.putChild('admin', admin)

...

In auth.py:

class PublicHTMLRealm(object):
   implements(IRealm)

   def requestAvatar(self, avatarId, mind, *interfaces):
       if IResource in interfaces:
           resc = UpdateManager()
           resc.realm = self
           return (IResource, resc, lambda: None)
       raise NotImplementedError()

in admin.py:

class UpdateManager(resource.Resource):
   isLeaf = False
   pathFromRoot = '/service/admin'

   def __init__(self):
       resource.Resource.__init__(self)
       self.newFull = NewFullResource()
       self.putChild('new_full', self.newFull)
       self.newDelta = NewDeltaResource()
       self.putChild('new_delta', self.newDelta)
       self.switch = SwitchResource()
       self.putChild('switch', self.switch)
       self.putChild('', self)

   def render_GET(self, request):
       ...

Is anything wrong here in these code parts? I have no errors shown in the console running with

twistd -ny server.tac
vian
  • 811
  • 2
  • 12
  • 27
  • 2
    It would be helpful to remove the '...'s and post a complete ,self-contained example that actually produces the results you are having difficulty with. (This is close, but it's still easier to answer the question with confidence if we know there's nothing else that might be causing the problem.) – Glyph Jul 19 '11 at 17:08

0 Answers0