Skip to content

Commit

Permalink
Tweaking the peewee code for generating the DOIDatasets object to use…
Browse files Browse the repository at this point in the history
… a proper primary key.

updating the psycopg2 package in requirements to reflect its new naming (psycopg2-binary)

Fixes pacifica#133
  • Loading branch information
kauberry committed May 2, 2018
1 parent a9fa118 commit a52465a
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions metadata/orm/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ def _build_object(self, attr):
@staticmethod
def get_append_item(obj_ref, fk_item_name, fk_obj_list):
"""Generate the proper item to append to the newly built object."""
# pylint: disable=protected-access
if 'key' in fk_obj_list.values() and 'value' in fk_obj_list.values():
append_item = {
'key_id': obj_ref.__data__['key'],
Expand All @@ -172,7 +171,7 @@ def _generate_fk_obj_list(self, obj_ref):
if len(valid_fk_obj_list) == 1:
fk_item_name = fk_obj_list[valid_fk_obj_list.pop()]
else:
fk_item_name = 'id'
fk_item_name = obj_ref.__class__._meta.__dict__['primary_key'].__dict__['column_name']
return fk_item_name, fk_obj_list

def from_hash(self, obj):
Expand Down
2 changes: 1 addition & 1 deletion metadata/orm/doi_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class DOIRelease(CherryPyAPI):
"""

doi = ForeignKeyField(
DOIDataSets, related_name='doi_releases', to_field='doi')
DOIDataSets, related_name='doi_entries', to_field='doi')
release = ForeignKeyField(TransactionRelease, related_name='doi_releases')

# pylint: disable=too-few-public-methods
Expand Down
2 changes: 1 addition & 1 deletion metadata/orm/doidatasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class DOIDataSets(CherryPyAPI):
+-------------------+-------------------------------------+
"""

doi = CharField(unique=True)
doi = CharField(primary_key=True)
name = CharField(default='')
encoding = CharField(default='UTF8')
creator = ForeignKeyField(Users, related_name='dois_created')
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mock
nose
peewee>2
pep257
psycopg2
psycopg2-binary
pylint
pytest
python-dateutil
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cherrypy
elasticsearch
peewee>2
psycopg2
psycopg2-binary
python-dateutil
requests
six

0 comments on commit a52465a

Please sign in to comment.