azavea / nyc-trees

NYC Parks Trees Count! 2015 tree census
GNU Affero General Public License v3.0
16 stars 6 forks source link

Cannot submit survey containing dead trees. #704

Closed maurizi closed 9 years ago

maurizi commented 9 years ago

Throws a validation error for a null circumference field:

ValidationError at /survey/
{'circumference': [u'This field cannot be null.']}

Request Method: POST
Request URL: http://kolkata.internal.azavea.com:8000/survey/
Django Version: 1.7.2
Python Executable: /usr/bin/python
Python Version: 2.7.6
Python Path: ['/opt/app', '/usr/local/bin', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/opt/app', '/opt/app/nyc_trees']
Server time: Sun, 1 Mar 2015 14:07:03 -0500
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.flatpages',
 'django.contrib.gis',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'django.contrib.admin',
 'registration',
 'django_statsd',
 'floppyforms',
 'apps.core',
 'apps.census_admin',
 'apps.event',
 'apps.home',
 'apps.login',
 'apps.survey',
 'apps.users',
 'apps.geocode',
 'debug_toolbar')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django_statsd.middleware.GraphiteRequestTimingMiddleware',
 'django_statsd.middleware.GraphiteMiddleware',
 'nyc_trees.middleware.SoftLaunchMiddleware',
 'debug_toolbar.middleware.DebugToolbarMiddleware')

Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  111.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/decorators.py" in _wrapped_view
  22.                 return view_func(request, *args, **kwargs)
File "/opt/app/apps/core/decorators.py" in wrapper
  91.             return view_fn(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django_tinsel/decorators.py" in routed
  33.             return req_method(request, *args2, **kwargs2)
File "/usr/local/lib/python2.7/dist-packages/django_tinsel/decorators.py" in newreq
  125.                 outp = req_function(request, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django_tinsel/decorators.py" in newreq
  106.         outp = req_function(request, *args, **kwargs)
File "/opt/app/apps/survey/views.py" in submit_survey
  231.     return _create_survey_and_trees(request)
File "/usr/local/lib/python2.7/dist-packages/django/db/transaction.py" in inner
  394.                 return func(*args, **kwargs)
File "/opt/app/apps/survey/views.py" in _create_survey_and_trees
  287.         tree.clean_and_save()
File "/opt/app/libs/mixins.py" in clean_and_save
  21.         self.full_clean()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py" in full_clean
  1012.             raise ValidationError(errors)

Exception Type: ValidationError at /survey/
Exception Value: {'circumference': [u'This field cannot be null.']}
Request information:
GET: No GET data

POST:
{"survey":{"blockface_id":29812,"has_trees":true,"is_mapped_in_blockface_polyline_direction":true,"is_left_side":false},"trees":[{"distance_to_tree":"22","curb_location":"OnCurb","status":"Dead","distance_to_end":"12"}]} = u''

FILES: No FILES data

COOKIES:
__utmz = '165514351.1414608813.9.4.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=http%3A%2F%2Fwww.azavea.com%2Fblogs%2Flabs%2F2014%2F10%2Fcreating-ansible-roles-from-scratch-part-1%2F'
__unam = '7900378-145f7176b40-7ba49cab-9'
_ga = 'GA1.4.1750676395.1388788273'
sessionid = 'piquhdwr8zbo30xqt8nd1u83786sah39'
djdt = 'hide'
csrftoken = 'gCejoLwHPJWxzeO0g2jXM6IUIxoczszW'
__utma = '165514351.1750676395.1388788273.1414606797.1414608813.9'

META:
HTTP_REFERER = 'http://kolkata.internal.azavea.com:8000/survey/'
SERVER_SOFTWARE = 'gunicorn/19.1.1'
SCRIPT_NAME = u''
HTTP_X_CSRFTOKEN = 'gCejoLwHPJWxzeO0g2jXM6IUIxoczszW'
REQUEST_METHOD = 'POST'
PATH_INFO = u'/survey/'
SERVER_PROTOCOL = 'HTTP/1.0'
QUERY_STRING = ''
CONTENT_LENGTH = '220'
HTTP_USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0'
HTTP_CONNECTION = 'close'
HTTP_COOKIE = '__utma=165514351.1750676395.1388788273.1414606797.1414608813.9; __utmz=165514351.1414608813.9.4.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=http%3A%2F%2Fwww.azavea.com%2Fblogs%2Flabs%2F2014%2F10%2Fcreating-ansible-roles-from-scratch-part-1%2F; __unam=7900378-145f7176b40-7ba49cab-9; _ga=GA1.4.1750676395.1388788273; csrftoken=gCejoLwHPJWxzeO0g2jXM6IUIxoczszW; djdt=hide; sessionid=piquhdwr8zbo30xqt8nd1u83786sah39'
SERVER_NAME = '127.0.0.1'
REMOTE_ADDR = '127.0.0.1'
wsgi.url_scheme = 'http'
SERVER_PORT = '8000'
HTTP_PRAGMA = 'no-cache'
HTTP_X_REQUESTED_WITH = 'XMLHttpRequest'
REMOTE_PORT = '42164'
wsgi.input = <gunicorn.http.body.Body object at 0x7f73ac348b10>
HTTP_HOST = 'kolkata.internal.azavea.com:8000'
wsgi.multithread = False
HTTP_CACHE_CONTROL = 'no-cache'
HTTP_ACCEPT = 'application/json, text/javascript, */*; q=0.01'
wsgi.version = 
RAW_URI = '/survey/'
wsgi.run_once = False
wsgi.errors = <gunicorn.http.wsgi.WSGIErrorsWraper object at 0x7f73ac15d650>
wsgi.multiprocess = False
HTTP_ACCEPT_LANGUAGE = 'en-US,en;q=0.5'
gunicorn.socket = <socket._socketobject object at 0x7f73ac294600>
CONTENT_TYPE = 'application/x-www-form-urlencoded; charset=UTF-8'
HTTP_X_FORWARDED_FOR = '10.0.2.2'
wsgi.file_wrapper = ''
CSRF_COOKIE = u'gCejoLwHPJWxzeO0g2jXM6IUIxoczszW'
HTTP_ACCEPT_ENCODING = 'gzip, deflate'

Settings:
Using settings module nyc_trees.settings.development
USE_L10N = False
USE_THOUSAND_SEPARATOR = False
CSRF_COOKIE_SECURE = False
LANGUAGE_CODE = 'en-us'
ROOT_URLCONF = 'nyc_trees.urls'
MANAGERS = 
GEOCODE_FALLBACK_SUFFIX = ', New York, NY'
TEST_NON_SERIALIZED_APPS = []
ACCOUNT_ACTIVATION_DAYS = 7
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
STATIC_ROOT = '/var/www/nyc-trees/static/'
DJANGO_ROOT = '/opt/app/nyc_trees'
RESERVATIONS_LIMIT = 20
ALLOWED_HOSTS = []
MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage'
EMAIL_SUBJECT_PREFIX = '[Django] '
SEND_BROKEN_LINK_EMAILS = False
STATICFILES_FINDERS = 
THIRD_PARTY_APPS = 
SESSION_CACHE_ALIAS = 'default'
STATSD_PREFIX = 'django'
SESSION_COOKIE_DOMAIN = None
SESSION_COOKIE_NAME = 'sessionid'
ADMIN_FOR = 
TIME_INPUT_FORMATS = 
DATABASES = {'default': {'ENGINE': 'django.contrib.gis.db.backends.postgis', 'AUTOCOMMIT': True, 'ATOMIC_REQUESTS': False, 'NAME': 'nyc_trees', 'CONN_MAX_AGE': 0, 'TIME_ZONE': 'UTC', 'PORT': '5432', 'HOST': '33.33.33.30', 'USER': 'nyc_trees', 'TEST': {'COLLATION': None, 'CHARSET': None, 'NAME': 'test_nyc_trees', 'MIRROR': None}, 'PASSWORD': u'********************', 'OPTIONS': {}}}
FILE_UPLOAD_DIRECTORY_PERMISSIONS = None
FILE_UPLOAD_PERMISSIONS = None
FILE_UPLOAD_HANDLERS = 
TEMPLATE_CONTEXT_PROCESSORS = 
DEFAULT_CONTENT_TYPE = 'text/html'
NYC_BOUNDS = 
APPEND_SLASH = True
LOCALE_PATHS = 
DATABASE_ROUTERS = []
DEFAULT_TABLESPACE = ''
LOCAL_APPS = 
YEAR_MONTH_FORMAT = 'F Y'
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'
CACHES = {'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}
SERVER_EMAIL = 'root@localhost'
SESSION_COOKIE_PATH = '/'
SILENCED_SYSTEM_CHECKS = ['1_6.W001', '1_6.W002']
MIDDLEWARE_CLASSES = 
USE_I18N = False
THOUSAND_SEPARATOR = ','
SECRET_KEY = u'********************'
LANGUAGE_COOKIE_NAME = 'django_language'
DEFAULT_INDEX_TABLESPACE = ''
TRANSACTIONS_MANAGED = False
LOGGING_CONFIG = 'logging.config.dictConfig'
SIGNING_BACKEND = 'django.core.signing.TimestampSigner'
STATICFILES_DIR = '/var/cache/nyc-trees/static/'
SOFT_LAUNCH_REGEXES = ['^/user/', '^/accounts/']
TEMPLATE_LOADERS = 
FIRST_DAY_OF_WEEK = 0
WSGI_APPLICATION = 'nyc_trees.wsgi.application'
TEMPLATE_DEBUG = True
X_FRAME_OPTIONS = 'SAMEORIGIN'
AUTHENTICATION_BACKENDS = 'django.contrib.auth.backends.ModelBackend'
FORCE_SCRIPT_NAME = None
USE_X_FORWARDED_HOST = False
DEFAULT_CHARSET = 'utf-8'
SESSION_COOKIE_SECURE = False
STATIC_FILES_MAPPING = {}
CSRF_COOKIE_DOMAIN = None
FILE_CHARSET = 'utf-8'
DEBUG = True
LANGUAGE_COOKIE_DOMAIN = None
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
INSTALLED_APPS = 
LANGUAGES = 
COMMENTS_ALLOW_PROFANITIES = False
MAX_GROUP_IMAGE_SIZE_IN_BYTES = 102400
STATICFILES_DIRS = '/var/cache/nyc-trees/static/'
PREPEND_WWW = False
SECURE_PROXY_SSL_HEADER = None
LANGUAGE_COOKIE_AGE = None
SESSION_COOKIE_HTTPONLY = True
TILER_URL = '//kolkata.internal.azavea.com:7000'
DEBUG_PROPAGATE_EXCEPTIONS = False
INTERNAL_IPS = 
MONTH_DAY_FORMAT = 'F j'
LOGIN_URL = '/accounts/login/'
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
TIME_FORMAT = 'P'
AUTH_USER_MODEL = 'core.User'
DATE_INPUT_FORMATS = 
CSRF_COOKIE_NAME = 'csrftoken'
EMAIL_HOST_PASSWORD = u'********************'
PASSWORD_RESET_TIMEOUT_DAYS = u'********************'
SESSION_FILE_PATH = None
CACHE_MIDDLEWARE_ALIAS = 'default'
SESSION_SAVE_EVERY_REQUEST = False
NUMBER_GROUPING = 0
SESSION_ENGINE = 'django.contrib.sessions.backends.db'
CSRF_FAILURE_VIEW = 'django.views.csrf.csrf_failure'
CSRF_COOKIE_PATH = '/'
LOGIN_REDIRECT_URL = 'user_detail_redirect'
DECIMAL_SEPARATOR = '.'
RESERVATION_TIME_PERIOD = datetime.timedelta(14)
IGNORABLE_404_URLS = 
MIGRATION_MODULES = {}
TEMPLATE_STRING_IF_INVALID = ''
SOFT_LAUNCH_REDIRECT_URL = '/'
LOGOUT_URL = '/accounts/logout/'
EMAIL_USE_TLS = False
FIXTURE_DIRS = '/opt/app/fixtures'
EMAIL_HOST = 'localhost'
DATE_FORMAT = 'N j, Y'
STATSD_CLIENT = 'django_statsd.clients.normal'
MEDIA_ROOT = '/var/www/nyc-trees/media/'
LANGUAGE_COOKIE_PATH = '/'
DEFAULT_EXCEPTION_REPORTER_FILTER = 'django.views.debug.SafeExceptionReporterFilter'
ADMINS = 
FORMAT_MODULE_PATH = None
DEFAULT_FROM_EMAIL = 'treescount.help@parks.nyc.gov'
MEDIA_URL = '/media/'
DATETIME_FORMAT = 'N j, Y, P'
TEMPLATE_DIRS = '/opt/app/templates'
SITE_ID = 1
DISALLOWED_USER_AGENTS = 
ALLOWED_INCLUDE_ROOTS = 
LOGGING = {'loggers': {'django.request': {'handlers': ['console'], 'propagate': True, 'level': 'ERROR'}}, 'version': 1, 'disable_existing_loggers': False, 'filters': {'require_debug_false': {'()': 'django.utils.log.RequireDebugFalse'}}, 'handlers': {'console': {'class': 'logging.StreamHandler', 'level': 'DEBUG'}}}
SHORT_DATE_FORMAT = 'm/d/Y'
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
CACHE_MIDDLEWARE_KEY_PREFIX = u'********************'
TIME_ZONE = 'America/New_York'
REGISTRATION_AUTO_LOGIN = True
FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
POSTGIS_VERSION = 
EMAIL_USE_SSL = False
OMGEO_SETTINGS = [['omgeo.services.EsriWGS', {}]]
STATSD_HOST = '33.33.33.30'
SITE_NAME = 'nyc_trees'
SESSION_COOKIE_AGE = 1209600
SETTINGS_MODULE = 'nyc_trees.settings.development'
USE_ETAGS = False
SITE_ROOT = '/opt/app'
LANGUAGES_BIDI = 
FILE_UPLOAD_TEMP_DIR = None
CSRF_COOKIE_AGE = 31449600
STATIC_URL = '/static/'
EMAIL_PORT = 25
USE_TZ = True
SHORT_DATETIME_FORMAT = 'm/d/Y P'
PASSWORD_HASHERS = u'********************'
SOFT_LAUNCH_ENABLED = False
ABSOLUTE_URL_OVERRIDES = {}
DJANGO_APPS = 
CACHE_MIDDLEWARE_SECONDS = 600
DEBUG_TOOLBAR_CONFIG = {'INTERCEPT_REDIRECTS': False, 'SHOW_TEMPLATE_CONTEXT': True}
CSRF_COOKIE_HTTPONLY = False
DATETIME_INPUT_FORMATS = 
EMAIL_HOST_USER = ''
PROFANITIES_LIST = u'********************'

You're seeing this error because you have DEBUG = True in your
Django settings file. Change that to False, and Django will
display a standard 500 page.
maurizi commented 9 years ago

Nevermind, this was a misunderstanding on my part. I did not realize we collect circumference for dead trees as well.