Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.5.0 to 2.6.0 error: TypeError: issubclass() arg 1 must be a class #792

Closed
kayluhb opened this issue Oct 1, 2019 · 4 comments · Fixed by #885
Closed

2.5.0 to 2.6.0 error: TypeError: issubclass() arg 1 must be a class #792

kayluhb opened this issue Oct 1, 2019 · 4 comments · Fixed by #885

Comments

@kayluhb
Copy link

kayluhb commented Oct 1, 2019

Hello,

Thanks for all the work on the new release.

I am however getting this error when upgrading to 2.6.0 from 2.5.0 and I just wanted to make sure I understand the change.

 Traceback (most recent call last):
   File "src/manage.py", line 22, in <module>
     execute_from_command_line(sys.argv)
   File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
     utility.execute()
   File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
     self.fetch_command(subcommand).run_from_argv(self.argv)
   File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.7/site-packages/django/core/management/base.py", line 323, in run_from_argv
     self.execute(*args, **cmd_options)
   File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.7/site-packages/django/core/management/base.py", line 361, in execute
     self.check()
   File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.7/site-packages/django/core/management/base.py", line 390, in check
     include_deployment_checks=include_deployment_checks,
   File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 65, in _run_checks
     issues.extend(super()._run_checks(**kwargs))
   File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.7/site-packages/django/core/management/base.py", line 377, in _run_checks
     return checks.run_checks(**kwargs)
   File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.7/site-packages/django/core/checks/registry.py", line 72, in run_checks
     new_errors = check(app_configs=app_configs)
   File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.7/site-packages/django/contrib/admin/checks.py", line 111, in check_dependencies
     if not _contains_subclass('django.contrib.auth.middleware.AuthenticationMiddleware', settings.MIDDLEWARE):
   File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.7/site-packages/django/contrib/admin/checks.py", line 43, in _contains_subclass
     candidate_cls = import_string(path)
   File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.7/site-packages/django/utils/module_loading.py", line 17, in import_string
     module = import_module(module_path)
   File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.7/importlib/__init__.py", line 127, in import_module
     return _bootstrap._gcd_import(name[level:], package, level)
   File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
   File "<frozen importlib._bootstrap>", line 983, in _find_and_load
   File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
   File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
   File "<frozen importlib._bootstrap_external>", line 728, in exec_module
   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
   File "/app/src/ems_api/middleware.py", line 5, in <module>
     from ems.schema import loaders as ems_loaders, nodes
   File "/app/src/ems/schema/nodes.py", line 44, in <module>
     class BenefitSetNode(graphene_django.DjangoObjectType):
   File "/app/src/ems/schema/nodes.py", line 48, in BenefitSetNode
     benefits = fields.DjangoListField("ems.schema.nodes.BenefitNode")
   File "/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.7/site-packages/graphene_django/fields.py", line 23, in __init__
     _type, DjangoObjectType
 TypeError: issubclass() arg 1 must be a class

Does this mean I can no longer pass strings into DjangoListField?

e.g. benefits = fields.DjangoListField("ems.schema.nodes.BenefitNode")

@NateScarlet
Copy link

This should caused by #732 .
Don't know why dynamic type support is dropped for DjangoListField.

@stale
Copy link

stale bot commented Feb 12, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Feb 12, 2020
@zbyte64 zbyte64 removed the wontfix label Feb 12, 2020
@zbyte64
Copy link
Collaborator

zbyte64 commented Feb 12, 2020

Wasn't aware this was a feature at one point. Reopening for now, we should open an issue to make this an official feature/enhancement with unit testing.

@jkimbo
Copy link
Member

jkimbo commented Feb 23, 2020

I also didn't realise that that was a feature! I've created PR to fix it: #885

Sorry for the inconvenience @kayluhb and thanks @NateScarlet for figuring out the case, it made fixing it very easy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants