Skip to content

Commit

Permalink
👌 IMPROVE: Add AuthInfo joins to QueryBuilder (#5195)
Browse files Browse the repository at this point in the history
Allow for `with_user` and `with_computer` when querying `AuthInfo`
  • Loading branch information
chrisjsewell authored Oct 24, 2021
1 parent a80812c commit 6e272a3
Show file tree
Hide file tree
Showing 4 changed files with 225 additions and 178 deletions.
4 changes: 2 additions & 2 deletions aiida/orm/computers.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def objects(cls) -> ComputerCollection: # pylint: disable=no-self-argument
def __init__( # pylint: disable=too-many-arguments
self,
label: str = None,
hostname: str = None,
hostname: str = '',
description: str = '',
transport_type: str = '',
scheduler_type: str = '',
Expand Down Expand Up @@ -137,7 +137,7 @@ def _hostname_validator(cls, hostname: str) -> None:
"""
Validates the hostname.
"""
if not hostname.strip():
if not (hostname or hostname.strip()):
raise exceptions.ValidationError('No hostname specified')

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion aiida/orm/implementation/querybuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class EntityTypes(Enum):


EntityRelationships: Dict[str, Set[str]] = {
'authinfo': set(),
'authinfo': {'with_computer', 'with_user'},
'comment': {'with_node', 'with_user'},
'computer': {'with_node'},
'group': {'with_node', 'with_user'},
Expand Down
Loading

0 comments on commit 6e272a3

Please sign in to comment.