Skip to content
This repository has been archived by the owner on May 13, 2020. It is now read-only.

Commit

Permalink
pep8, typos, minor whatnots
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Groszer committed Mar 5, 2013
1 parent 24e3c7d commit 7a2665b
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/mongopersist/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ Non-Persistent Objects
----------------------

As you can see, even the reference looks nice and uses the standard Mongo DB
reference construct. But what about arbitrary non-persistent, but pickable,
reference construct. But what about arbitrary non-persistent, but picklable,
objects? Well, let's create a phone number object for that:

>>> class Phone(object):
Expand Down
3 changes: 2 additions & 1 deletion src/mongopersist/conflict.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
from __future__ import absolute_import
import struct
import zope.interface
from mongopersist import interfaces, serialize
from mongopersist import interfaces


def p64(v):
"""Pack an integer or long into a 8-byte string"""
Expand Down
4 changes: 2 additions & 2 deletions src/mongopersist/datamanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class LoggingDecorator(object):

# these are here to be easily patched
ADD_TB = True
TB_LIMIT = 10 # 10 should be sufficient to figure
TB_LIMIT = 10 # 10 should be sufficient to figure

def __init__(self, collection, function):
self.collection = collection
Expand Down Expand Up @@ -131,7 +131,7 @@ def find_one_object(self, *args, **kw):

def __getattr__(self, name):
attr = getattr(self.collection, name)
if MONGO_ACCESS_LOGGING and name in self.LOGGED_METHODS:
if MONGO_ACCESS_LOGGING and name in self.LOGGED_METHODS:
attr = LoggingDecorator(self.collection, attr)
if name in self.QUERY_METHODS:
attr = FlushDecorator(self._datamanager, attr)
Expand Down
4 changes: 2 additions & 2 deletions src/mongopersist/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class MongoConnectionPool(object):
_mongoConnectionFactory = pymongo.MongoClient

def __init__(self, host='localhost', port=27017, logLevel=20,
tz_aware=True, w=1, j=True, connectionFactory=None):
tz_aware=True, w=1, j=True, connectionFactory=None):
self.host = host
self.port = port
self.key = 'mongopersist-%s-%s' %(self.host, self.port)
Expand Down Expand Up @@ -85,7 +85,7 @@ def __init__(self, host='localhost', port=27017,
def get(self):
try:
dm = LOCAL.data_manager
except AttributeError, err:
except AttributeError:
conn = self.pool.connection
dm = LOCAL.data_manager = datamanager.MongoDataManager(
conn, **self.dm_kwargs)
Expand Down
3 changes: 1 addition & 2 deletions src/mongopersist/pymongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
##############################################################################
"""PyMongo Patches"""
from __future__ import absolute_import
from bson.son import SON
from copy import deepcopy


def DBRef__init__(self, collection, id, database=None, _extra=None):
self._DBRef__collection = collection
Expand Down
6 changes: 4 additions & 2 deletions src/mongopersist/serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,10 @@ def get_object(self, state, obj):
if serializer.can_read(state):
return serializer.read(state)

if isinstance(state, dict) and ('_py_factory' in state or \
'_py_type' in state or '_py_persistent_type' in state):
if isinstance(state, dict) and (
'_py_factory' in state
or '_py_type' in state
or '_py_persistent_type' in state):
# Load a non-persistent object.
return self.get_non_persistent_object(state, obj)
if isinstance(state, (tuple, list)):
Expand Down
2 changes: 1 addition & 1 deletion src/mongopersist/zope/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class IMongoContainer(zope.interface.Interface):
_m_database = zope.schema.ASCIILine(
title=u'Mongo Database',
description=(
u'Specifies the MDB in which to store items. If ``None``, the '
u'Specifies the Mongo DB in which to store items. If ``None``, the '
u'default database will be used.'),
default=None)

Expand Down

0 comments on commit 7a2665b

Please sign in to comment.