Skip to content

Commit 7d1b4ed

Browse files
author
Chad Faurie
committed
Fixed local variable 'list_length' referenced before assignment
1 parent 8d27450 commit 7d1b4ed

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

graphene_mongo/fields.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ def get_query(cls, model, info, **args):
107107
return [], 0
108108

109109
objs = model.objects()
110+
110111
if args:
111112
reference_fields = get_model_reference_fields(model)
112113
reference_args = {}
@@ -146,6 +147,8 @@ def get_query(cls, model, info, **args):
146147
if last is not None:
147148
# https://github.com/graphql-python/graphene-mongo/issues/20
148149
objs = objs[-(last+1):]
150+
else:
151+
list_length = objs.count()
149152

150153
return objs, list_length
151154

0 commit comments

Comments
 (0)