[Sqlalchemy-tickets] Issue #3361: Python3.4 and SQLAlchemy documentation generator (zzzeek/sqlalche
Brought to you by:
zzzeek
|
From: eirnym <iss...@bi...> - 2015-04-09 11:36:21
|
New issue 3361: Python3.4 and SQLAlchemy documentation generator https://bitbucket.org/zzzeek/sqlalchemy/issue/3361/python34-and-sqlalchemy-documentation eirnym: I have project with SQLAlchemy. Almost all my models are with documentation as described in documentation. I want to use builtin `help()` to have some interactive help on my models but I have exception and don't know how to deal with. I have project with SQLAlchemy. Almost all my models are with documentation as described in documentation. I want to use builtin `help()` to have some interactive help on my models but I have exception and don't know how to deal with. Exception is: `TypeError: Boolean value of this clause is not defined`. After digging the code with `pdb`, I've found that it is caused with `__table__` attribute and python 3.4 (py3k?) `inspect` changes. This example works fine with Python 2.7, but I develop Python 3.4+ application and I really need it fixed. Python version: 3.4.3 SQLAlchemy version: 0.9.9, 1.0.0b5 My model: from sqlalchemy import Column, Integer, String, Unicode from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class Model(Base): __tablename__ = 'model' id = Column(Integer, primary_key=True, doc='ID column for this model') data = Column(String(250), nullable=False, unique=True, doc='Some model data') from sqlalchemy import Column, Integer, String, Unicode from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class Category(Base): __tablename__ = 'category' id = Column(Integer, primary_key=True) slug = Column(String(250), nullable=False, unique=True) Exception: >>> help(model.Category) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/_sitebuiltins.py", line 103, in __call__ return pydoc.help(*args, **kwds) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/pydoc.py", line 1827, in __call__ self.help(request) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/pydoc.py", line 1877, in help else: doc(request, 'Help on %s:', output=self._output) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/pydoc.py", line 1614, in doc pager(render_doc(thing, title, forceload)) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/pydoc.py", line 1607, in render_doc return title % desc + '\n\n' + renderer.document(object, name) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/pydoc.py", line 372, in document if inspect.isclass(object): return self.docclass(*args) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/pydoc.py", line 1272, in docclass for name, kind, cls, value in classify_class_attrs(object) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/pydoc.py", line 205, in classify_class_attrs for (name, kind, cls, value) in inspect.classify_class_attrs(object): File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/inspect.py", line 405, in classify_class_attrs obj = get_obj or dict_obj File "/Users/eirnym/venv/34/ens/lib/python3.4/site-packages/sqlalchemy/sql/elements.py", line 538, in __bool__ raise TypeError("Boolean value of this clause is not defined") TypeError: Boolean value of this clause is not defined |