mirror of
https://github.com/internetarchive/warcprox.git
synced 2025-01-18 13:22:09 +01:00
rename Document.get to Document.load to avoid masking dict.get
This commit is contained in:
parent
3c1faded3c
commit
ad0e1b1fd7
@ -157,7 +157,7 @@ class Document(dict, object):
|
||||
return cls.__name__.lower()
|
||||
|
||||
@classmethod
|
||||
def get(cls, rethinker, pk):
|
||||
def load(cls, rethinker, pk):
|
||||
'''
|
||||
Retrieve an instance from the database.
|
||||
'''
|
||||
|
2
setup.py
2
setup.py
@ -3,7 +3,7 @@ import codecs
|
||||
|
||||
setuptools.setup(
|
||||
name='rethinkstuff',
|
||||
version='0.2.0.dev61',
|
||||
version='0.2.0.dev62',
|
||||
packages=['rethinkstuff'],
|
||||
classifiers=[
|
||||
'Programming Language :: Python :: 2.7',
|
||||
|
@ -369,7 +369,7 @@ def test_orm(r):
|
||||
assert d._updates == {}
|
||||
assert d._deletes == set()
|
||||
|
||||
d_copy = SomeDoc.get(r, d.id)
|
||||
d_copy = SomeDoc.load(r, d.id)
|
||||
assert d == d_copy
|
||||
|
||||
d['zuh'] = 'toot'
|
||||
@ -385,7 +385,7 @@ def test_orm_pk(r):
|
||||
rethinker.table_create(cls.table, primary_key='not_id').run()
|
||||
|
||||
with pytest.raises(Exception):
|
||||
NonstandardPrimaryKey.get(r, 'no_such_thing')
|
||||
NonstandardPrimaryKey.load(r, 'no_such_thing')
|
||||
|
||||
NonstandardPrimaryKey.table_create(r)
|
||||
|
||||
@ -398,7 +398,7 @@ def test_orm_pk(r):
|
||||
assert len(f.keys()) == 1
|
||||
|
||||
with pytest.raises(KeyError):
|
||||
NonstandardPrimaryKey.get(r, 'no_such_thing')
|
||||
NonstandardPrimaryKey.load(r, 'no_such_thing')
|
||||
|
||||
# new doc with (only) primary key
|
||||
d = NonstandardPrimaryKey(r, {'not_id': 1})
|
||||
@ -406,7 +406,7 @@ def test_orm_pk(r):
|
||||
assert d.pk_value == 1
|
||||
d.save()
|
||||
|
||||
d_copy = NonstandardPrimaryKey.get(r, 1)
|
||||
d_copy = NonstandardPrimaryKey.load(r, 1)
|
||||
assert d == d_copy
|
||||
|
||||
# new doc with something in it
|
||||
@ -418,7 +418,7 @@ def test_orm_pk(r):
|
||||
e.save()
|
||||
assert e.not_id
|
||||
|
||||
e_copy = NonstandardPrimaryKey.get(r, e.not_id)
|
||||
e_copy = NonstandardPrimaryKey.load(r, e.not_id)
|
||||
assert e == e_copy
|
||||
e_copy['blah'] = 'toot'
|
||||
e_copy.save()
|
||||
|
Loading…
x
Reference in New Issue
Block a user