[Zope3-Users] Zope3.3.0-zope.rdb implementation - bug, feature?

Maciej Wisniowski maciej.wisniowski at coig.katowice.pl
Fri Oct 13 06:30:08 EDT 2006


Hi!

I've asked this question on Zope-DB already but get
no answer, so maybe this list is better to ask for this issue.

I've just tried to use Zope3.3.0 with cx_Oracle adapter
and to check whether connection works I've used
typical for Oracle statement:

select 1 from dual

I've received error:
TypeError: __slots__ must be identifiers

The problem is (I think) with class Row or
RowClassFactory defined
in zope/rdb/__init__.py.

There is current implementation of RowClassFactory:

def RowClassFactory(columns):
 """Creates a Row object"""
 klass_namespace = {}
 klass_namespace['__Security_checker__'] = InstanceOnlyDescriptor(
     NamesChecker(columns))
 klass_namespace['__slots__'] = tuple(columns)

 return type('GeneratedRowClass', (Row,), klass_namespace)

in my case:

klass_namespace is {'__slots__':('1',)}

and '1' causes error (number is not a proper identifier).

select 1 as abc from dual

executes correctly.

I've implemented temporary solution that simply changes
the names of numeric attributes (like '1') to prefixed ones
(like '_1') It works but I'm not sure whether it is proper
solution for something other than tests, but in general
who may use this kind of dynamically created labels for
something useful...?

Is this issue a bug or feature or something else? I'm not able to
recognise them myself (especially after submitting
request.locale issue on z3-five list :)).

I would like to know your's opinions
before submiting a bug and/or trying to create a patch.

-- 
Maciej Wisniowski


More information about the Zope3-users mailing list