Browse Source

drop debugging from ContentDirectory...

print traceback if it isn't the exception to return a special
errorcode..

[git-p4: depot-paths = "//depot/": change = 774]
replace/4e84fdb41ea781c7a8f872baa423e8b3be4045a7
John-Mark Gurney 19 years ago
parent
commit
a5fbdb43cc
2 changed files with 15 additions and 16 deletions
  1. +12
    -16
      ContentDirectory.py
  2. +3
    -0
      upnp.py

+ 12
- 16
ContentDirectory.py View File

@@ -122,22 +122,18 @@ class ContentDirectoryControl(UPnPPublisher, dict):
if ObjectID not in self: if ObjectID not in self:
raise errorCode(701) raise errorCode(701)


try:
if BrowseFlag == 'BrowseDirectChildren':
ch = self.getchildren(ObjectID)[StartingIndex: StartingIndex + RequestedCount]
filter(lambda x, s = self, d = didl: d.addItem(s[x.id].checkUpdate()) and None, ch)
else:
didl.addItem(self[ObjectID])

result = {'BrowseResponse': {'Result': didl.toString() ,
'NumberReturned': didl.numItems(),
'TotalMatches': didl.numItems(),
'UpdateID': self[ObjectID].updateID }}

except:
traceback.print_exc(file=log.logfile)

log.msg('Returning: %s' % result)
if BrowseFlag == 'BrowseDirectChildren':
ch = self.getchildren(ObjectID)[StartingIndex: StartingIndex + RequestedCount]
filter(lambda x, s = self, d = didl: d.addItem(s[x.id].checkUpdate()) and None, ch)
else:
didl.addItem(self[ObjectID])

result = {'BrowseResponse': {'Result': didl.toString() ,
'NumberReturned': didl.numItems(),
'TotalMatches': didl.numItems(),
'UpdateID': self[ObjectID].updateID }}

#log.msg('Returning: %s' % result)


return result return result




+ 3
- 0
upnp.py View File

@@ -4,6 +4,7 @@
# Copyright 2005, Tim Potter <tpot@samba.org> # Copyright 2005, Tim Potter <tpot@samba.org>


from twisted.web import soap from twisted.web import soap
from twisted.python import log


import SOAPpy import SOAPpy


@@ -27,6 +28,8 @@ class UPnPPublisher(soap.SOAPPublisher):
else: else:
if isinstance(e, errorCode): if isinstance(e, errorCode):
status = e.status status = e.status
else:
failure.printTraceback(file = log.logfile)
fault = SOAPpy.faultType("%s:Server" % SOAPpy.NS.ENV_T, "Method %s failed." % methodName) fault = SOAPpy.faultType("%s:Server" % SOAPpy.NS.ENV_T, "Method %s failed." % methodName)
response = SOAPpy.buildSOAP(fault, encoding=self.encoding) response = SOAPpy.buildSOAP(fault, encoding=self.encoding)
self._sendResponse(request, response, status=status) self._sendResponse(request, response, status=status)

Loading…
Cancel
Save