Skip to content

Commit

Permalink
Syntax fixes, use mbid instead of id
Browse files Browse the repository at this point in the history
  • Loading branch information
ferbncode committed Jul 3, 2017
1 parent a668d9a commit 500bddb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
15 changes: 14 additions & 1 deletion critiquebrainz/frontend/external/musicbrainz_db/includes.py
@@ -1,6 +1,19 @@
import critiquebrainz.frontend.external.musicbrainz_db.exceptions as mb_exceptions

RELATABLE_TYPES = ['area', 'artist', 'label', 'place', 'event', 'recording', 'release', 'release-group', 'series', 'url', 'work', 'instrument']
RELATABLE_TYPES = [
'area',
'artist',
'label',
'place',
'event',
'recording',
'release',
'release-group',
'series',
'url',
'work',
'instrument'
]
RELATION_INCLUDES = [entity + '-rels' for entity in RELATABLE_TYPES]
TAG_INCLUDES = ["tags", "user-tags"]
RATING_INCLUDES = ["ratings", "user-ratings"]
Expand Down
8 changes: 4 additions & 4 deletions critiquebrainz/frontend/external/musicbrainz_db/place.py
Expand Up @@ -12,19 +12,19 @@
THREAD_POOL_PROCESSES = 10


def get_place_by_id(id):
def get_place_by_id(mbid):
"""Get place with the MusicBrainz ID.
Args:
id (uuid): MBID(gid) of the place.
mbid (uuid): MBID(gid) of the place.
Returns:
Dictionary containing the place information.
"""
key = cache.gen_key(id)
key = cache.gen_key(mbid)
place = cache.get(key)
if not place:
place = _get_place_by_id(
id, includes=['artist-rels', 'place-rels', 'release-group-rels', 'url-rels'],
mbid, includes=['artist-rels', 'place-rels', 'release-group-rels', 'url-rels'],
)
cache.set(key=key, val=place, time=DEFAULT_CACHE_EXPIRATION)
return place
Expand Down

0 comments on commit 500bddb

Please sign in to comment.