congrats on finding the engine thing.  (to the list...shouild we perhaps
require "None" for the engine if they want to use the default engine ?  or
make it keyword only ?  else this kind of issue will happen over and over
again...)

for this particular question, the short answer is:

  class MyClass(object):
    ...

the (very) long answer is:

   http://www.python.org/download/releases/2.2.3/descrintro/


Jonathan Hayward http://JonathansCorner.com wrote:
> I am experiencing a different error. I am getting the following complaint:
>
> Traceback (most recent call last):
>   File
> "/server1/users/jonathan/creations/inventions/software/insight/alchemy",
> line 5798, in ?
>     init()
>   File
> "/server1/users/jonathan/creations/inventions/software/insight/alchemy",
> line 5470, in init
>     database_init()
>   File
> "/server1/users/jonathan/creations/inventions/software/insight/alchemy",
> line 4980, in database_init
>     histogram.mapper = sqlalchemy.mapper(histogram, histogram_table)
>   File "/usr/lib/python2.4/site-packages/PIL/__init__.py", line 75, in
> mapper
>
>   File "build/bdist.linux-i686/egg/sqlalchemy/mapping/mapper.py", line 61,
> in __init__
> TypeError: Class 'histogram' is not a new-style class
>
> The line being complained about is:
>
>         histogram.mapper = sqlalchemy.mapper(histogram, histogram_table)
>
> Class histogram is defined as:
>
> class histogram(ancestor):
>     """Class for a (possibly weighted) histogram."""
>     def __init__(self):
>         ancestor.__init__(self)
>         self.occurrences = {}
>         self.total_occurrences = 0
>     def add_occurrence(self, category, number=1):
>         if category in sequence(self.occurrences):
>             self.occurrences[category] += number
>         else:
>             self.occurrences[category] = number
>         self.total_occurrences += number
>     def finalize(self):
>         occurrences_as_list = []
>         for word in sequence(self.occurrences):
>             occurrences_as_list.append((word, self.occurrences[word]))
>         sort_by_item(occurrences_as_list, 0)
>         self.finalized_data = tuple(occurrences_as_list)
>         #self.occurrences = None
>     def get_occurrences(self, category):
>         if self.occurrences == None:
>             result = binary_search(self.finalized_data, category,
> (0,0))[1]
>             return result
>         else:
>             if category in sequence(self.occurrences):
>                 return self.occurrences[category]
>             else:
>                 return 0
>     def get_proportion(self, category):
>         if self.total_occurrences > 0:
>             return float(self.get_occurrences(category)) / \
>               float(self.total_occurrences)
>         else:
>             return 0
>     def get_score(self, other_histogram, thesaurus = None):
>         if self.total_occurrences == 0 or \
>           other_histogram.total_occurrences == 0:
>             return 0
>         else:
>             numerator = 0
>             for key in sequence(self.occurrences):
>                 if thesaurus == None:
>                     numerator += self.get_occurrences(key) * \
>                       other_histogram.get_occurrences(key)
>                 else:
>                     if thesaurus.contains(key):
>                         numerator += self.get_occurrences(key) * \
>                           other_histogram.get_occurrences(key)
>             denominator = self.total_occurrences * \
>               other_histogram.total_occurrences
>             return float(numerator) / float(denominator)
>     def get_total_occurrences(self):
>         return total_occurrences
>     def get_words(self):
>         return self.occurrences.keys()
>     def remove_occurrence(self, category, number=1):
>         if category in sequence(self.occurrences):
>             difference = min(number, self.occurrences[category])
>             self.occurrences[category] -= number
>             if self.occurrences[category] <= 0:
>                 del self.occurrences[category]
>             self.total_occurrences -= min
>
>
>
> --
> ++ Jonathan Hayward, [EMAIL PROTECTED]
> ** To see an award-winning website with stories, essays, artwork,
> ** games, and a four-dimensional maze, why not visit my home page?
> ** All of this is waiting for you at http://JonathansCorner.com
>
> ** If you'd like a Google Mail (gmail.com) account, please tell me!
>



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to