{"issue":{"title":"Connection.connectionFactory and cursorFactory a treated as methods of Connection","user":{"login":"eallik","id":17533,"url":"https://api.github.com/users/eallik","avatar_url":"https://secure.gravatar.com/avatar/e49c2e77533477d3c7107f029d9d4b09?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"e49c2e77533477d3c7107f029d9d4b09"},"created_at":"2011-12-12T16:42:11Z","milestone":null,"labels":[],"state":"closed","updated_at":"2011-12-27T16:53:36Z","id":2525112,"closed_at":"2011-12-26T23:23:56Z","html_url":"https://github.com/wulczer/txpostgres/issues/11","pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"body":"in `txpostgres.py:248` you have:\r\n\r\n```python\r\nclass Connection(_PollingMixin):\r\n    ...\r\n    connectionFactory = psycopg2.connect\r\n    cursorFactory = Cursor\r\n```\r\n\r\nnow later in that file in `Connection.connect` you have:\r\n\r\n```python\r\n            self._connection = self.connectionFactory(*args, **kwargs)\r\n```\r\n\r\nThe problem there is that, on Python 2.7 at least, `self.connectionFactory` is treated as a bound method of `Connection`, so `self` is passed in implicitly, causing `psycopg2.connect` to error out:\r\n\r\n\tTraceback (most recent call last):\r\n\tFailure: twisted.internet.defer.FirstError: FirstError[#0, [Failure instance: Traceback: <type 'exceptions.TypeError'>: argument 1 must be string, not Connection\r\n        [snip]\r\n\t--- <exception caught here> ---\r\n\t/Users/erik.allik/.virtualenvs/dts-agent/lib/python2.7/site-packages/txpostgres/txpostgres.py:293:connect\r\n\t/Users/erik.allik/.virtualenvs/dts-agent/lib/python2.7/site-packages/psycopg2/__init__.py:179:connect\r\n\t]]\r\n```\r\n","number":11,"url":"https://api.github.com/repos/wulczer/txpostgres/issues/11","comments":12,"assignee":null},"comment":{"user":{"login":"eallik","id":17533,"url":"https://api.github.com/users/eallik","avatar_url":"https://secure.gravatar.com/avatar/e49c2e77533477d3c7107f029d9d4b09?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"e49c2e77533477d3c7107f029d9d4b09"},"created_at":"2011-12-27T16:53:36Z","updated_at":"2011-12-27T16:53:36Z","id":3282954,"body":"How can that snippet work with any psycopg2 version if it declares a class attribute that will be treated as a method? Won't it fail for the same reason this ticket was opened?","url":"https://api.github.com/repos/wulczer/txpostgres/issues/comments/3282954"},"action":"created"}