durusmail: quixote-users: Quixote changing object type, from list to _QuoteWrapper
Quixote changing object type, from list to _QuoteWrapper
2003-01-27
2003-01-27
2003-01-27
2003-01-27
2003-01-27
2003-01-27
2003-01-27
Quixote changing object type, from list to _QuoteWrapper
Nicola Larosa
2003-01-27
I have a dictionary called "interface". One of its fields is a list called
"services". A PTL tries to index its first element, like this:

interface["services"][0]

If the PTL is of the [plain] type, it all works, but the HTML comes out all
quoted. Look at the first half of the attached log.

If the PTL is of the [html] type, which is what I use in all the rest of the
application, I get a:

TypeError: unindexable object

because Quixote changes the type of the interface["services"] list to:



(traceback in the second half of the log), and PrettyPrint does non
understand it's a list anymore, either.

I gave a look to _py_htmltext.py , but cannot quite grok what those
metaclass hacks intend. :^)

All of this with v.0.6b1 (and SCGI v.0.5).

Help!


--
"Python is the Beatles of programming languages."
   Aaron K. Johnson on comp.lang.python

Nicola Larosa - nico@tekNico.net
[plain]

interface:
{'bgColor': '#e8e8e8',
 'description': 'blackwidow.example.com',
 'icon': 'redBall.gif',
 'ipv4': '192.168.1.3',
 'lastWarning': 'Date - Time',
 'numServices': 10,
 'services': [{'statusCSS': 'TableText', 'name': 'ssh'},
              {'statusCSS': 'TableText', 'name': 'http'},
              {'statusCSS': 'TableText', 'name': 'https'},
              {'statusCSS': 'TableText', 'name': 'printer'},
              {'statusCSS': 'TableText', 'name': 'mysql'},
              {'statusCSS': 'TableText', 'name': 'x11'}],
 'traffic': 'x%'}

type(interface["services"]): 

---

[html]

interface:
{: '#e8e8e8',
 'description': 'blackwidow.example.com',
 'icon': 'redBall.gif',
 'ipv4': '192.168.1.3',
 'lastWarning': 'Date - Time',
 'numServices': 10,
 'services': [{'statusCSS': 'TableText', 'name': 'ssh'}, {'statusCSS':
'TableText', 'name': 'http'}, {'statusCSS': 'TableText', 'name': 'https'},
{'statusCSS': 'TableText', 'name': 'printer'}, {'statusCSS': 'TableText',
'name': 'mysql'}, {'statusCSS': 'TableText', 'name': 'x11'}],
 'traffic': 'x%'}

type(interface["services"]): 

[2003-01-27 13:46:11] exception caught
Traceback (most recent call last):
  File "/opt/python/lib/python2.2/site-packages/quixote/publish.py", line 660,
in publish
    output = self.process_request(request, env)
  File "/opt/python/lib/python2.2/site-packages/quixote/publish.py", line 642,
in process_request
    output = self.try_publish(request, env.get('PATH_INFO', ''))
  File "/opt/python/lib/python2.2/site-packages/quixote/publish.py", line 590,
in try_publish
    output = object(request)
  File "/home/nl/Araknos/aKab/aKab/Web/hostUI.ptl", line 361, in view
    self._interfaces(request, params)
  File "/home/nl/Araknos/aKab/aKab/Web/hostUI.ptl", line 254, in _interfaces
    service = interface["services"][0]
TypeError: unindexable object
reply