Skip to content
Advertisement

AttributeError: ‘NoneType’ object has no attribute ‘GetDataStore’

I guys, I developing a utility in python and i have 2 object the main class and an database helper for get sqlserver data. database.py gaemodel.py My problem is when i try run code return me this error What is wrong ?? Answer First of all: The __new__ method should be named __init__. Remove the global _host etc. line Then

Python unit test with base and sub class

I currently have a few unit tests which share a common set of tests. Here’s an example: The output of the above is: Is there a way to rewrite the above so that the very first testCommon is not called? EDIT: Instead of running 5 tests above, I want it to run only 4 tests, 2 from the SubTest1 and

sqlalchemy flush() and get inserted id?

I want to do something like this: f = Foo(bar=’x’) session.add(f) session.flush() # do additional queries using f.id before commit() print f.id # should be not None session.commit() But f.id is …

How to convert a nested Python dict to object?

I’m searching for an elegant way to get data using attribute access on a dict with some nested dicts and lists (i.e. javascript-style object syntax). For example: Should be accessible in this way: I think, this is not possible without recursion, but what would be a nice way to get an object style for dicts? Answer Update: In Python 2.6

can’t see records inserted by django test case

I’m trying to provide integration to my django application from subversion through the post commit hook. I have a django test case (a subclass of unittest.TestCase) that (a) inserts a couple of records into a table, (b) spawns an svn commit, (c) svn commit runs a hook that uses my django model to look up info. I’m using an sqlite3

Advertisement