Skip to content

Commit

Permalink
change cache reset to work on User.obects only
Browse files Browse the repository at this point in the history
implement specific cache reset method for User.objects
  • Loading branch information
ltalirz committed Oct 27, 2019
1 parent 1a636d0 commit 61d696e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
9 changes: 0 additions & 9 deletions aiida/orm/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,6 @@ def all(self):
"""
return [_[0] for _ in self.query().all()]

def reset(self):
"""
Remove lazily constructed collection instance.
Removes lazily constructed collection instance from LazyStore (constructed again upon next request).
Useful to clear any internal caches of the collection.
"""
self._COLLECTIONS.pop((self.entity_type, self.backend))


class Entity(object):
"""An AiiDA entity"""
Expand Down
6 changes: 6 additions & 0 deletions aiida/orm/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ def get_default(self):

return self._default_user

def reset(self):
"""
Reset internal caches (default user).
"""
self._default_user = self.UNDEFINED

REQUIRED_FIELDS = ['first_name', 'last_name', 'institution']

def __init__(self, email, first_name='', last_name='', institution='', backend=None):
Expand Down

0 comments on commit 61d696e

Please sign in to comment.