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

'srcf.controllib.jobs.ChangeSocietyAdmin object' has no attribute 'has_danger' #22

Closed
eleanor-clifford opened this issue Dec 19, 2024 · 1 comment · Fixed by #23
Closed

Comments

@eleanor-clifford
Copy link
Member

/admin/jobs/failed is currently 500ing. Here is the error:

  File "/societies/control/checkouts/live/control/webapp/../templates/admin/view_jobs.html", line 23, in <module>
    <tr class="{{ job.state }}{% if job.has_danger %} table-warning{% elif note_count[job.job_id] %} table-secondary{% endif %}">
jinja2.exceptions.UndefinedError: 'srcf.controllib.jobs.ChangeSocietyAdmin object' has no attribute 'has_danger'

I can't replicate this locally or see any reason why ChangeSocietyAdmin wouldn't have this attribute... (but I don't have a proper dev setup for control so my attempt to replicate wasn't very similar to the deployment)

@rsa33
Copy link
Member

rsa33 commented Dec 19, 2024

What a confusing exception, given has_danger definitely exists as a property -- the problem is it references another property owner_has_danger, which in turn references the danger attribute that doesn't exist on the new Missing placeholder object, and that AttributeError gets swallowed:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/srcf/controllib/jobs.py", line 299, in <lambda>
    has_danger = property(lambda s: s.owner_has_danger or s.society_has_danger)
  File "/usr/lib/python3/dist-packages/srcf/controllib/jobs.py", line 298, in <lambda>
    society_has_danger = property(lambda s: s.society and s.society.danger)
AttributeError: 'Missing' object has no attribute 'danger'

@rsa33 rsa33 closed this as completed in 00c3f70 Jan 9, 2025
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.

2 participants