dcramer/sentry — Issue #361: Cleanup command fails
Author: omansion
Created: 2012-02-22 20:07:11+00:00
State: open

Launching cleanup command fails with following traceback:

```python
Oliviers-MacBook-Pro:spcrond olivier$ sentry cleanup
Traceback (most recent call last):
File "/Users/olivier/Workspace/bin/virtualenv/2.7/bin/sentry", line 9, in
load_entry_point('sentry==3.0.3', 'console_scripts', 'sentry')()
File "/Users/olivier/Workspace/bin/virtualenv/2.7/lib/python2.7/site-packages/sentry-3.0.3-py2.7.egg/sentry/utils/runner.py", line 72, in main
initializer=initialize_app,
File "/Users/olivier/Workspace/bin/virtualenv/2.7/lib/python2.7/site-packages/logan-0.2.1-py2.7.egg/logan/runner.py", line 136, in run_app
management.execute_from_command_line([runner_name, command] + command_args)
File "/Users/olivier/Workspace/bin/virtualenv/2.7/lib/python2.7/site-packages/Django-1.3.1.1-py2.7.egg/django/core/management/__init__.py", line 429, in execute_from_command_line
utility.execute()
File "/Users/olivier/Workspace/bin/virtualenv/2.7/lib/python2.7/site-packages/Django-1.3.1.1-py2.7.egg/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/olivier/Workspace/bin/virtualenv/2.7/lib/python2.7/site-packages/Django-1.3.1.1-py2.7.egg/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Users/olivier/Workspace/bin/virtualenv/2.7/lib/python2.7/site-packages/Django-1.3.1.1-py2.7.egg/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/Users/olivier/Workspace/bin/virtualenv/2.7/lib/python2.7/site-packages/sentry-3.0.3-py2.7.egg/sentry/management/commands/cleanup.py", line 35, in handle
cleanup(**options)
TypeError: cleanup() got an unexpected keyword argument 'settings'
```

Also, the cleanup command overlap the Django "core" one (which remove outdated sessions). It would be great to rename it if possible.

Then if I fix the options issue, I get the following error:

```python
Oliviers-MacBook-Pro:spcrond olivier$ sentry cleanup --resolved
Traceback (most recent call last):
File "/Users/olivier/Workspace/bin/virtualenv/2.7/bin/sentry", line 9, in
load_entry_point('sentry==3.0.3', 'console_scripts', 'sentry')()
File "/Users/olivier/Workspace/bin/virtualenv/2.7/lib/python2.7/site-packages/sentry-3.0.3-py2.7.egg/sentry/utils/runner.py", line 72, in main
initializer=initialize_app,
File "/Users/olivier/Workspace/bin/virtualenv/2.7/lib/python2.7/site-packages/logan-0.2.1-py2.7.egg/logan/runner.py", line 136, in run_app
management.execute_from_command_line([runner_name, command] + command_args)
File "/Users/olivier/Workspace/bin/virtualenv/2.7/lib/python2.7/site-packages/Django-1.3.1.1-py2.7.egg/django/core/management/__init__.py", line 429, in execute_from_command_line
utility.execute()
File "/Users/olivier/Workspace/bin/virtualenv/2.7/lib/python2.7/site-packages/Django-1.3.1.1-py2.7.egg/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/olivier/Workspace/bin/virtualenv/2.7/lib/python2.7/site-packages/Django-1.3.1.1-py2.7.egg/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Users/olivier/Workspace/bin/virtualenv/2.7/lib/python2.7/site-packages/Django-1.3.1.1-py2.7.egg/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/Users/olivier/Workspace/bin/virtualenv/2.7/lib/python2.7/site-packages/sentry-3.0.3-py2.7.egg/sentry/management/commands/cleanup.py", line 38, in handle
cleanup(**options)
File "/Users/olivier/Workspace/bin/virtualenv/2.7/lib/python2.7/site-packages/sentry-3.0.3-py2.7.egg/sentry/queue/tasks/cleanup.py", line 81, in cleanup
qs = qs.filter(status=1)
File "/Users/olivier/Workspace/bin/virtualenv/2.7/lib/python2.7/site-packages/Django-1.3.1.1-py2.7.egg/django/db/models/query.py", line 550, in filter
return self._filter_or_exclude(False, *args, **kwargs)
File "/Users/olivier/Workspace/bin/virtualenv/2.7/lib/python2.7/site-packages/Django-1.3.1.1-py2.7.egg/django/db/models/query.py", line 568, in _filter_or_exclude
clone.query.add_q(Q(*args, **kwargs))
File "/Users/olivier/Workspace/bin/virtualenv/2.7/lib/python2.7/site-packages/Django-1.3.1.1-py2.7.egg/django/db/models/sql/query.py", line 1194, in add_q
can_reuse=used_aliases, force_having=force_having)
File "/Users/olivier/Workspace/bin/virtualenv/2.7/lib/python2.7/site-packages/Django-1.3.1.1-py2.7.egg/django/db/models/sql/query.py", line 1069, in add_filter
negate=negate, process_extras=process_extras)
File "/Users/olivier/Workspace/bin/virtualenv/2.7/lib/python2.7/site-packages/Django-1.3.1.1-py2.7.egg/django/db/models/sql/query.py", line 1260, in setup_joins
"Choices are: %s" % (name, ", ".join(names)))
django.core.exceptions.FieldError: Cannot resolve keyword 'status' into field. Choices are: date, group, id, project, time_spent_count, time_spent_total, times_seen
```