ManoSeimas / manoseimas.lt

ManoSeimas.lt website source code.
http://manoseimas.lt/
GNU Affero General Public License v3.0
4 stars 3 forks source link

recompute_stats fails with AttributeError: 'NoneType' object has no attribute '_id' #58

Closed mgedmin closed 9 years ago

mgedmin commented 9 years ago
vagrant@vagrant-ubuntu-trusty-64: /vagrant [git:master=] $ bin/django recompute_stats
Computing precomputed model fields
Computing fields for StenogramStatement
Computing fields for ParliamentMember                                       
|----------| 0/154   0% [elapsed: 00:00 left: ?, ? iters/sec]Traceback (most recent call last):
  File "bin/django", line 82, in <module>
    sys.exit(djangorecipe.manage.main('manoseimas.settings.development'))
  File "/vagrant/eggs/djangorecipe-1.11-py2.7.egg/djangorecipe/manage.py", line 9, in main
    management.execute_from_command_line(sys.argv)
  File "/vagrant/eggs/Django-1.8.3-py2.7.egg/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/vagrant/eggs/Django-1.8.3-py2.7.egg/django/core/management/__init__.py", line 330, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/vagrant/eggs/Django-1.8.3-py2.7.egg/django/core/management/base.py", line 393, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/vagrant/eggs/Django-1.8.3-py2.7.egg/django/core/management/base.py", line 444, in execute
    output = self.handle(*args, **options)
  File "/vagrant/eggs/Django-1.8.3-py2.7.egg/django/utils/decorators.py", line 145, in inner
    return func(*args, **kwargs)
  File "/vagrant/manoseimas/mps_v2/management/commands/recompute_stats.py", line 84, in handle
    self.compute_precomputed_fields()
  File "/vagrant/manoseimas/mps_v2/management/commands/recompute_stats.py", line 74, in compute_precomputed_fields
    value = compute_fn_callable()
  File "/vagrant/manoseimas/mps_v2/models.py", line 167, in get_vote_percentage
    votes = sum(self.votes.values()) if self.votes else 0
  File "/vagrant/manoseimas/mps_v2/models.py", line 163, in votes
    return get_mp_votes(self.source_id)
  File "/vagrant/manoseimas/votings/models.py", line 241, in get_mp_votes
    node_id = node._id
AttributeError: 'NoneType' object has no attribute '_id'
mgedmin commented 9 years ago

This error went away after I successfully ran bin/django syncpositions --update, after fixing #59.