A Python UPnP Media Server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
3.6 KiB

  1. """
  2. ################################################################################
  3. #
  4. # SOAPpy - Cayce Ullman (cayce@actzero.com)
  5. # Brian Matthews (blm@actzero.com)
  6. # Gregory Warnes (gregory_r_warnes@groton.pfizer.com)
  7. # Christopher Blunck (blunck@gst.com)
  8. #
  9. ################################################################################
  10. # Copyright (c) 2003, Pfizer
  11. # Copyright (c) 2001, Cayce Ullman.
  12. # Copyright (c) 2001, Brian Matthews.
  13. #
  14. # All rights reserved.
  15. #
  16. # Redistribution and use in source and binary forms, with or without
  17. # modification, are permitted provided that the following conditions are met:
  18. # Redistributions of source code must retain the above copyright notice, this
  19. # list of conditions and the following disclaimer.
  20. #
  21. # Redistributions in binary form must reproduce the above copyright notice,
  22. # this list of conditions and the following disclaimer in the documentation
  23. # and/or other materials provided with the distribution.
  24. #
  25. # Neither the name of actzero, inc. nor the names of its contributors may
  26. # be used to endorse or promote products derived from this software without
  27. # specific prior written permission.
  28. #
  29. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  30. # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  31. # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  32. # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
  33. # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  34. # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  35. # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  36. # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  37. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  38. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  39. #
  40. ################################################################################
  41. """
  42. from __future__ import nested_scopes
  43. ident = '$Id: NS.py,v 1.3 2004/01/31 04:20:05 warnes Exp $'
  44. from version import __version__
  45. ##############################################################################
  46. # Namespace Class
  47. ################################################################################
  48. def invertDict(dict):
  49. d = {}
  50. for k, v in dict.items():
  51. d[v] = k
  52. return d
  53. class NS:
  54. XML = "http://www.w3.org/XML/1998/namespace"
  55. ENV = "http://schemas.xmlsoap.org/soap/envelope/"
  56. ENC = "http://schemas.xmlsoap.org/soap/encoding/"
  57. XSD = "http://www.w3.org/1999/XMLSchema"
  58. XSD2 = "http://www.w3.org/2000/10/XMLSchema"
  59. XSD3 = "http://www.w3.org/2001/XMLSchema"
  60. XSD_L = [XSD, XSD2, XSD3]
  61. EXSD_L= [ENC, XSD, XSD2, XSD3]
  62. XSI = "http://www.w3.org/1999/XMLSchema-instance"
  63. XSI2 = "http://www.w3.org/2000/10/XMLSchema-instance"
  64. XSI3 = "http://www.w3.org/2001/XMLSchema-instance"
  65. XSI_L = [XSI, XSI2, XSI3]
  66. URN = "http://soapinterop.org/xsd"
  67. # For generated messages
  68. XML_T = "xml"
  69. ENV_T = "SOAP-ENV"
  70. ENC_T = "SOAP-ENC"
  71. XSD_T = "xsd"
  72. XSD2_T= "xsd2"
  73. XSD3_T= "xsd3"
  74. XSI_T = "xsi"
  75. XSI2_T= "xsi2"
  76. XSI3_T= "xsi3"
  77. URN_T = "urn"
  78. NSMAP = {ENV_T: ENV, ENC_T: ENC, XSD_T: XSD, XSD2_T: XSD2,
  79. XSD3_T: XSD3, XSI_T: XSI, XSI2_T: XSI2, XSI3_T: XSI3,
  80. URN_T: URN}
  81. NSMAP_R = invertDict(NSMAP)
  82. STMAP = {'1999': (XSD_T, XSI_T), '2000': (XSD2_T, XSI2_T),
  83. '2001': (XSD3_T, XSI3_T)}
  84. STMAP_R = invertDict(STMAP)
  85. def __init__(self):
  86. raise Error, "Don't instantiate this"