On Tue, 2011-03-01 at 23:21 -0800, Eric wrote:
> config.scan() problem
>
> Hi all,
> Just starting to work with Pyramid, followed the tutorial to get a
> basic site running. Then I grabbed some files from a TG2.1 app I had
> been working on and dropped them into the Pyramid app directory for
> future use (Win 7, latest Pyramid, Py 2.6.6). The next time I
> restarted and refreshed the root I got an error from SQLAlchemy
> (running in debug mode in Wing Pro). I traced it back to an old model
> file that I had dropped in from the TG2.1 app. Seems that something
> goes wrong (I'm pretty new at all of this...) during the scan?
Specifics of your error aside (I'm not sure why code would be trying to
construct a model instance at module scope, and it's really mostly
unrelated), the scan process will recursively import every Python module
and package under a given directory. If you had the following package:
foo--
|
|-- __init__.py
|
bar--
|
|-- __init__.py
|
|--- tests.py
running scan('foo') would have approximately the effect of:
import foo
import foo.bar
import foo.bar.tests
There is no good way right now to tell it to ignore a package or module
(although it will ignore non-package directories). A feature to do so
has been requested, although so far folks have gotten a very long way by
just doing fewer insane things at module scope, so it hasn't really been
a priority.
- C
>
> The error occurs on this line in views.py after the refresh:
>
> root = dbsession.query(MyModel).filter(MyModel.name==u'root').first()
>
> ArgumentError: Column-based expression object expected for argument
> 'order_by'; got: 'PartTypes.part_types_id', type <type 'str'>
>
> This is probably doing me a favor and is telling me I have an error in
> the old model file but it makes me wonder about scanning all files
> since it seems like something in the SQLAlchemy setup/config got
> confused. Is there a command that you can put at the top of a file to
> abort the scan process for that file? Or should I just not worry
> about it?
>
> Thanks,
> Eric
>
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.