I get this message afer it's been looping for a while:

RuntimeError: maximum recursion depth exceeded

The code producing it is a function called xmlrepr which basically takes
some basic python types and turns them into an xml document:

-- BEGIN xmlify.py --
from types import ListType, DictionaryType, InstanceType

def xmlrepr(object, name):
 if type(object) == ListType:
  xml = "<%s>" % name
  for item in object:
   xml+= xmlrepr(item, "item")

  xml = xml + "</%s>" % name
  return xml

 elif type(object) == DictionaryType:
  xml = "<%s>" % name
  for (key, value) in object.items():
   xml+= xmlrepr(value, key)

  xml = xml + "</%s>" % name
  return xml
 else:
  return "<%s>%s</%s>" % (name, object, name)
-- END xmlify.py --

The code invoking this is here:

-- BEGIN Main.py --
 def list(self):
  """Lists the current entries."""
  entries = []
  for entry in Entry.select('all'):
   entries.append(entry.content())

  self.model = entries
-- END --

Where Entry is an SQLObject:

-- BEGIN entry.py --
class Entry(SQLObject):
 _columns = [IntCol('date', default=None), Col('content', default=None),
IntCol('mood', default=5)]
 _connection = SQLiteConnection('C:/Home/Projects/blog/blog.db', debug=1)

 def content(self):
  return {'date': self.date, 'content': self.content, 'mood': self.mood}
-- END entry.py --

Hope that helped :)

----- Original Message -----
From: "Brad Bollenbach" <brad@bbnet.ca>
To: <simen@lunarlounge.org>
Sent: Saturday, May 10, 2003 4:42 PM
Subject: Re: [SQLObject] Problems with str() on SQLObjects


> Date: Sat, 10 May 2003 09:14:52 -0500
> From: Brad Bollenbach <brad@bbnet.ca>
> To: sqlobject-discuss@lists.sourceforge.net
> Subject: Re: [SQLObject] Problems with str() on SQLObjects
>
> On 05/10/03 14:49, Simen Brekken wrote:
> > Hi, I'm working on an MVC app and I'm using SQLObject for the Model part
of it, however I'm having some problems getting the values of normal string
columns:
> >
> >   File "...\xmlify.py", line 22, in xmlrepr
> >     return "<"+name+">"+str(object)+"</"+name+">"
> >   File "C:\Utils\Python\Lib\site-packages\SQLObject\SQLObject.py", line
834, in __repr__
> >     return '<%s %i %s>' \
> >   File "C:\Utils\Python\Lib\site-packages\SQLObject\SQLObject.py", line
843, in _reprItems
> >     r = repr(value)
> >   File "C:\Utils\Python\Lib\site-packages\SQLObject\SQLObject.py", line
834, in __repr__
> >
> > It runs into an infinite loop! 'object'. The strange thing is that this
only happens to Col() or StringCol() types, IntCol() works fine.
>
> Can you post the error message after the traceback or is it just a
> simple KeyboardInterrupt from getting out of the infinite loop (if in
> fact it's an infinite loop)?
>
> Also, a simple test case to reproduce the bug will shorten the
> distance between problem and solution.
>
> --
> Brad Bollenbach
> BBnet.ca
>
>
 
___
SIMEN BREKKEN / born to synthesize.