specify / specify7

Specify 7
https://www.specifysoftware.org/products/specify-7/
GNU General Public License v2.0
66 stars 36 forks source link

Error when adding a new value to a non read only pick list #1065

Closed tlammer closed 2 years ago

tlammer commented 3 years ago

Reported by VIMS She started at the CO form and clicked to add a new CE, then clicked to add a new Locality. On the locality form, she clicked to add a Locality Detail record.
In locality details, she entered a new value in the WaterBody field, which is a non read only picklist field. A dialog pops up asking if she wants to add a new value. She clicks yes and the prompt goes away. The value does not appear in the field and an error dialog pops up. In 6, there is no pop up and the value is added as soon as the person clicks out of the field. Here is the error message: BusinessRuleException at /api/specify/picklist/35/ adding item to picklist Water Body would exceed size limit of 50 items.

Request Method: PUT Request URL: http://db6.biwebdbtest.nhm.ku.edu/api/specify/picklist/35/ Django Version: 2.2.10 Python Executable: /opt/specify7/ve/bin/python3.6 Python Version: 3.6.9 Python Path: ['/opt/specify7', '/opt/specify7', '/opt/specify7/ve/bin', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/opt/specify7/ve/lib/python3.6/site-packages', '/opt/specify7'] Server time: Fri, 12 Nov 2021 16:18:58 -0600 Installed Applications: ('django.contrib.sessions', 'django.contrib.staticfiles', 'django.contrib.contenttypes', 'django.contrib.auth', 'specifyweb.specify', 'specifyweb.stored_queries', 'specifyweb.businessrules', 'specifyweb.express_search', 'specifyweb.context', 'specifyweb.attachment_gw', 'specifyweb.frontend', 'specifyweb.barvis', 'specifyweb.report_runner', 'specifyweb.interactions', 'specifyweb.workbench', 'specifyweb.notifications', 'specifyweb.export', 'specifyweb.raven_placeholder', 'django_jsonfield_backport') Installed Middleware: ['django.middleware.gzip.GZipMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'specifyweb.context.middleware.ContextMiddleware']

Traceback:

File "/opt/specify7/ve/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner

  1. response = get_response(request)

File "/opt/specify7/ve/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response

  1. response = self.process_exception_by_middleware(e, request)

File "/opt/specify7/ve/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response

  1. response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/opt/specify7/specifyweb/specify/views.py" in wrapped

  1. return view(request, *args, **kwargs)

File "/opt/specify7/ve/lib/python3.6/site-packages/django/views/decorators/cache.py" in _cache_controlled

  1. response = viewfunc(request, *args, **kw)

File "/opt/specify7/specifyweb/specify/views.py" in wrapped

  1. return view(request, *args, **kwargs)

File "/opt/specify7/specifyweb/specify/views.py" in view

  1. return dispatch_func(request, *args, **kwargs)

File "/opt/specify7/specifyweb/specify/api.py" in resource_dispatch

  1. model, id, version, data)

File "/usr/lib/python3.6/contextlib.py" in inner

  1. return func(*args, **kwds)

File "/opt/specify7/specifyweb/specify/api.py" in put_resource

  1. return update_obj(collection, agent, name, id, version, data)

File "/opt/specify7/specifyweb/specify/api.py" in update_obj

  1. handle_to_many(collection, agent, obj, data)

File "/opt/specify7/specifyweb/specify/api.py" in handle_to_many

  1. rel_obj = create_obj(collection, agent, rel_model, rel_data, parent_obj=obj)

File "/opt/specify7/specifyweb/specify/api.py" in create_obj

  1. autonumber_and_save(collection, agent.specifyuser, obj)

File "/opt/specify7/specifyweb/specify/autonumbering.py" in autonumber_and_save

  1. obj.save()

File "/opt/specify7/specifyweb/specify/build_models.py" in save

  1. return super(model, self).save(*args, **kwargs)

File "/opt/specify7/ve/lib/python3.6/site-packages/django/db/models/base.py" in save

  1. force_update=force_update, update_fields=update_fields)

File "/opt/specify7/ve/lib/python3.6/site-packages/django/db/models/base.py" in save_base

  1. update_fields=update_fields,

File "/opt/specify7/ve/lib/python3.6/site-packages/django/dispatch/dispatcher.py" in send

  1. for receiver in self._live_receivers(sender)

File "/opt/specify7/ve/lib/python3.6/site-packages/django/dispatch/dispatcher.py" in

  1. for receiver in self._live_receivers(sender)

File "/opt/specify7/specifyweb/businessrules/orm_signal_handler.py" in handler

  1. rule(kwargs['instance'])

File "/opt/specify7/specifyweb/businessrules/picklist_rules.py" in picklistitem_pre_save

  1. raise BusinessRuleException("adding item to picklist {} would exceed size limit of {} items.".format(pl.name, pl.sizelimit))

Exception Type: BusinessRuleException at /api/specify/picklist/35/ Exception Value: adding item to picklist Water Body would exceed size limit of 50 items. Request information: USER: Specifyuser object (1)

GET: No GET data

POST: No POST data

FILES: No FILES data

COOKIES: _ga = 'GA1.2.52251437.1577130942' _cap = '396478351582133405' amplitude_id_9f6c0bb8b82021496164c672a7dc98d6_edmku.edu = 'eyJkZXZpY2VJZCI6IjA4ZDE5N2NlLTAzNjktNDhiNi1hNWFmLTk3MjY5OTUyMWYxYVIiLCJ1c2VySWQiOm51bGwsIm9wdE91dCI6ZmFsc2UsInNlc3Npb25JZCI6MTYxOTIwMzk4MTYwOCwibGFzdEV2ZW50VGltZSI6MTYxOTIwMzk4MTYwOSwiZXZlbnRJZCI6MCwiaWRlbnRpZnlJZCI6MSwic2VxdWVuY2VOdW1iZXIiOjF9' amplitude_id_408774472b1245a7df5814f20e7484d0ku.edu = 'eyJkZXZpY2VJZCI6ImIzOTE1ODBmLWI5ODEtNDVmNi1hMmU0LWQ0N2Q0YWUzZDMwZSIsInVzZXJJZCI6bnVsbCwib3B0T3V0IjpmYWxzZSwic2Vzc2lvbklkIjoxNjE5MjAzOTgyMDQ3LCJsYXN0RXZlbnRUaW1lIjoxNjE5MjAzOTgyNDU1LCJldmVudElkIjoxLCJpZGVudGlmeUlkIjo0LCJzZXF1ZW5jZU51bWJlciI6NX0=' _fbp = 'fb.1.1632932805755.829466009' collection = '4' language = 'en-us' _gid = 'GA1.2.706815448.1636734152' csrftoken = 'PLGJ23TY5JCzC0CzNJxP2ed9iRnK3TQBRgqyY7gzsuqq2HmOFEmiNN0raLYdBNwL' sessionid = '4wz2nwsmv8k701dwbb6pqhkrtrsmonae'

META: CONTENT_LENGTH = '63687' CONTENT_TYPE = 'application/json' CSRF_COOKIE = 'PLGJ23TY5JCzC0CzNJxP2ed9iRnK3TQBRgqyY7gzsuqq2HmOFEmiNN0raLYdBNwL' HTTP_ACCEPT = 'application/json, text/javascript, /; q=0.01' HTTP_ACCEPT_ENCODING = 'gzip, deflate' HTTP_ACCEPT_LANGUAGE = 'en-US,en;q=0.9' HTTP_CONNECTION = 'close' HTTP_COOKIE = '_ga=GA1.2.52251437.1577130942; _cap=396478351582133405; amplitude_id_9f6c0bb8b82021496164c672a7dc98d6_edmku.edu=eyJkZXZpY2VJZCI6IjA4ZDE5N2NlLTAzNjktNDhiNi1hNWFmLTk3MjY5OTUyMWYxYVIiLCJ1c2VySWQiOm51bGwsIm9wdE91dCI6ZmFsc2UsInNlc3Npb25JZCI6MTYxOTIwMzk4MTYwOCwibGFzdEV2ZW50VGltZSI6MTYxOTIwMzk4MTYwOSwiZXZlbnRJZCI6MCwiaWRlbnRpZnlJZCI6MSwic2VxdWVuY2VOdW1iZXIiOjF9; amplitude_id_408774472b1245a7df5814f20e7484d0ku.edu=eyJkZXZpY2VJZCI6ImIzOTE1ODBmLWI5ODEtNDVmNi1hMmU0LWQ0N2Q0YWUzZDMwZSIsInVzZXJJZCI6bnVsbCwib3B0T3V0IjpmYWxzZSwic2Vzc2lvbklkIjoxNjE5MjAzOTgyMDQ3LCJsYXN0RXZlbnRUaW1lIjoxNjE5MjAzOTgyNDU1LCJldmVudElkIjoxLCJpZGVudGlmeUlkIjo0LCJzZXF1ZW5jZU51bWJlciI6NX0=; _fbp=fb.1.1632932805755.829466009; collection=4; language=en-us; _gid=GA1.2.706815448.1636734152; csrftoken=PLGJ23TY5JCzC0CzNJxP2ed9iRnK3TQBRgqyY7gzsuqq2HmOFEmiNN0raLYdBNwL; sessionid=4wz2nwsmv8k701dwbb6pqhkrtrsmonae' HTTP_HOST = 'db6.biwebdbtest.nhm.ku.edu' HTTP_ORIGIN = 'http://db6.biwebdbtest.nhm.ku.edu' HTTP_REFERER = 'http://db6.biwebdbtest.nhm.ku.edu/specify/view/collectionobject/new/' HTTP_USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36' HTTP_X_CSRFTOKEN = 'PLGJ23TY5JCzC0CzNJxP2ed9iRnK3TQBRgqyY7gzsuqq2HmOFEmiNN0raLYdBNwL' HTTP_X_FORWARDED_FOR = '10.125.131.237' HTTP_X_REAL_IP = '10.125.131.237' HTTP_X_REQUESTED_WITH = 'XMLHttpRequest' PATH_INFO = '/api/specify/picklist/35/' QUERY_STRING = '' RAW_URI = '/api/specify/picklist/35/' REMOTE_ADDR = '172.19.0.3' REMOTE_PORT = '48276' REQUEST_METHOD = 'PUT' SCRIPT_NAME = '' SERVER_NAME = '0.0.0.0' SERVER_PORT = '8000' SERVER_PROTOCOL = 'HTTP/1.0' SERVER_SOFTWARE = 'gunicorn/20.1.0' gunicorn.socket = <socket.socket fd=10, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('172.19.0.8', 8000), raddr=('172.19.0.3', 48276)> wsgi.errors = <gunicorn.http.wsgi.WSGIErrorsWrapper object at 0x7fca36df5940> wsgi.file_wrapper = '' wsgi.input = <gunicorn.http.body.Body object at 0x7fca36df5748> wsgi.input_terminated = True wsgi.multiprocess = True wsgi.multithread = False wsgi.run_once = False wsgi.url_scheme = 'http' wsgi.version = '(1, 0)'

Settings: Using settings module settings ABSOLUTE_URL_OVERRIDES = {} ADMINS = '()' ADMIN_MEDIA_PREFIX = '/static/admin/' ALLOWED_HOSTS = ['*'] ALLOW_SPECIFY6_PASSWORDS = '****' ALLOW_SUPPORT_LOGIN = False ANONYMOUS_USER = None APPEND_SLASH = True AUTHENTICATION_BACKENDS = ['django.contrib.auth.backends.ModelBackend'] AUTH_LDAP_SERVER_URI = None AUTH_PASSWORD_VALIDATORS = '****' AUTH_USER_MODEL = 'specify.Specifyuser' CACHES = {'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}} CACHE_MIDDLEWARE_ALIAS = 'default' CACHE_MIDDLEWARE_KEY_PREFIX = '****' CACHE_MIDDLEWARE_SECONDS = 600 CELERY_BROKER_URL = 'redis://redis/0' CELERY_RESULT_BACKEND = 'redis://redis/1' CELERY_TASK_DEFAULT_QUEUE = 'db6' CSRF_COOKIE_AGE = 31449600 CSRF_COOKIE_DOMAIN = None CSRF_COOKIE_HTTPONLY = False CSRF_COOKIE_NAME = 'csrftoken' CSRF_COOKIE_PATH = '/' CSRF_COOKIE_SAMESITE = 'Lax' CSRF_COOKIE_SECURE = False CSRF_FAILURE_VIEW = 'django.views.csrf.csrf_failure' CSRF_HEADER_NAME = 'HTTP_X_CSRFTOKEN' CSRF_TRUSTED_ORIGINS = [] CSRF_USE_SESSIONS = False DATABASES = {'default': {'ENGINE': 'specifyweb.hibernateboolsbackend.backends.mysql', 'NAME': 'specify', 'USER': 'MasterUser', 'PASSWORD': '****', 'HOST': '172.17.0.1', 'PORT': '', 'TEST': {'CHARSET': None, 'COLLATION': None, 'NAME': None, 'MIRROR': None}, 'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'CONN_MAX_AGE': 0, 'OPTIONS': {}, 'TIME_ZONE': None}} DATABASE_HOST = '172.17.0.1' DATABASE_NAME = 'specify' DATABASE_PORT = '' DATABASE_ROUTERS = [] DATA_UPLOAD_MAX_MEMORY_SIZE = 2621440 DATA_UPLOAD_MAX_NUMBER_FIELDS = 1000 DATETIME_FORMAT = 'N j, Y, P' DATETIME_INPUT_FORMATS = ['%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M:%S.%f', '%Y-%m-%d %H:%M', '%Y-%m-%d', '%m/%d/%Y %H:%M:%S', '%m/%d/%Y %H:%M:%S.%f', '%m/%d/%Y %H:%M', '%m/%d/%Y', '%m/%d/%y %H:%M:%S', '%m/%d/%y %H:%M:%S.%f', '%m/%d/%y %H:%M', '%m/%d/%y'] DATE_FORMAT = 'N j, Y' DATE_INPUT_FORMATS = ['%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', '%b %d %Y', '%b %d, %Y', '%d %b %Y', '%d %b, %Y', '%B %d %Y', '%B %d, %Y', '%d %B %Y', '%d %B, %Y'] DEBUG = True DEBUG_PROPAGATE_EXCEPTIONS = False DECIMAL_SEPARATOR = '.' DEFAULT_CHARSET = 'utf-8' DEFAULT_CONTENT_TYPE = 'text/html' DEFAULT_EXCEPTION_REPORTER_FILTER = 'django.views.debug.SafeExceptionReporterFilter' DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage' DEFAULT_FROM_EMAIL = 'webmaster@localhost' DEFAULT_INDEX_TABLESPACE = '' DEFAULT_TABLESPACE = '' DEPOSITORY_DIR = '/volumes/static-files/depository' DISABLE_AUDITING = False DISALLOWED_USER_AGENTS = [] EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'localhost' EMAIL_HOST_PASSWORD = '****' EMAIL_HOST_USER = '' EMAIL_PORT = 25 EMAIL_SSL_CERTFILE = None EMAIL_SSL_KEYFILE = '****' EMAIL_SUBJECT_PREFIX = '[Django] ' EMAIL_TIMEOUT = None EMAIL_USE_LOCALTIME = False EMAIL_USE_SSL = False EMAIL_USE_TLS = False FILE_CHARSET = 'utf-8' FILE_UPLOAD_DIRECTORY_PERMISSIONS = None FILE_UPLOAD_HANDLERS = ['django.core.files.uploadhandler.MemoryFileUploadHandler', 'django.core.files.uploadhandler.TemporaryFileUploadHandler'] FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440 FILE_UPLOAD_PERMISSIONS = None FILE_UPLOAD_TEMP_DIR = None FIRST_DAY_OF_WEEK = 0 FIXTURE_DIRS = [] FORCE_SCRIPT_NAME = None FORMAT_MODULE_PATH = None FORM_RENDERER = 'django.forms.renderers.DjangoTemplates' IGNORABLE_404_URLS = [] INSTALLED_APPS = "('django.contrib.sessions', 'django.contrib.staticfiles', 'django.contrib.contenttypes', 'django.contrib.auth', 'specifyweb.specify', 'specifyweb.stored_queries', 'specifyweb.businessrules', 'specifyweb.express_search', 'specifyweb.context', 'specifyweb.attachment_gw', 'specifyweb.frontend', 'specifyweb.barvis', 'specifyweb.report_runner', 'specifyweb.interactions', 'specifyweb.workbench', 'specifyweb.notifications', 'specifyweb.export', 'specifyweb.raven_placeholder', 'django_jsonfield_backport')" INTERNAL_IPS = [] JAVA_PATH = '/usr/bin/java' LANGUAGES = [('en-us', 'English')] LANGUAGES_BIDI = ['he', 'ar', 'fa', 'ur'] LANGUAGE_CODE = 'en-us' LANGUAGE_COOKIE_AGE = None LANGUAGE_COOKIE_DOMAIN = None LANGUAGE_COOKIE_NAME = 'django_language' LANGUAGE_COOKIE_PATH = '/' LOCALE_PATHS = "('/opt/specify7/frontend/locale',)" LOGGING = {'version': 1, 'disable_existing_loggers': False, 'formatters': {'standard': {'format': '[%(asctime)s] [%(levelname)s] [%(name)s:%(lineno)s] %(message)s', 'datefmt': '%d/%b/%Y %H:%M:%S'}}, 'handlers': {'console': {'level': 'DEBUG', 'class': 'logging.StreamHandler', 'formatter': 'standard'}}, 'loggers': {'django.request': {'handlers': ['console'], 'level': 'DEBUG', 'propagate': False}, 'specifyweb': {'handlers': ['console'], 'level': 'DEBUG', 'propagate': False}}} LOGGING_CONFIG = 'logging.config.dictConfig' LOGIN_REDIRECT_URL = '/' LOGIN_URL = '/accounts/login/' LOGOUT_REDIRECT_URL = None MANAGERS = '()' MASTER_NAME = 'MasterUser' MASTER_PASSWORD = '****' MEDIA_ROOT = '' MEDIA_URL = '' MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage' MIDDLEWARE = ['django.middleware.gzip.GZipMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'specifyweb.context.middleware.ContextMiddleware'] MIGRATION_MODULES = {} MONTH_DAY_FORMAT = 'F j' NOTIFICATION_TTL_DAYS = 7 NUMBER_GROUPING = 0 PASSWORD_HASHERS = '****' PASSWORD_RESET_TIMEOUT_DAYS = '****' PREPEND_WWW = False RAVEN_CONFIG = None REPORT_RUNNER_HOST = 'report-runner' REPORT_RUNNER_PORT = '8080' ROOT_URLCONF = 'specifyweb.urls' RO_MODE = False SA_DATABASE_URL = 'mysql://MasterUser:MasterPassword@172.17.0.1:3306/specify?charset=utf8' SA_POOL_RECYCLE = 3600 SCHEMA_LANGUAGE = 'en' SECRET_KEY = '****' SECURE_BROWSER_XSS_FILTER = False SECURE_CONTENT_TYPE_NOSNIFF = False SECURE_HSTS_INCLUDE_SUBDOMAINS = False SECURE_HSTS_PRELOAD = False SECURE_HSTS_SECONDS = 0 SECURE_PROXY_SSL_HEADER = None SECURE_REDIRECT_EXEMPT = [] SECURE_SSL_HOST = None SECURE_SSL_REDIRECT = False SERVER_EMAIL = 'root@localhost' SESSION_CACHE_ALIAS = 'default' SESSION_COOKIE_AGE = 1209600 SESSION_COOKIE_DOMAIN = None SESSION_COOKIE_HTTPONLY = True SESSION_COOKIE_NAME = 'sessionid' SESSION_COOKIE_PATH = '/' SESSION_COOKIE_SAMESITE = 'Lax' SESSION_COOKIE_SECURE = False SESSION_ENGINE = 'django.contrib.sessions.backends.file' SESSION_EXPIRE_AT_BROWSER_CLOSE = True SESSION_FILE_PATH = None SESSION_SAVE_EVERY_REQUEST = False SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer' SETTINGS_MODULE = 'settings' SHORT_DATETIME_FORMAT = 'm/d/Y P' SHORT_DATE_FORMAT = 'm/d/Y' SIGNING_BACKEND = 'django.core.signing.TimestampSigner' SILENCED_SYSTEM_CHECKS = [] SITE_ID = 1 SPECIFY_CONFIG_DIR = '/opt/Specify/config' SPECIFY_THICK_CLIENT = '/opt/Specify' STATICFILES_DIRS = "(('config', '/opt/Specify/config'),)" STATICFILES_FINDERS = "('django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder')" STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage' STATIC_ROOT = '' STATIC_URL = '/static/' STATS_URL = 'https://stats.specifycloud.org/capture' SUPPORT_LOGIN_TTL = 300 TEMPLATES = [{'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': {'context_processors': ['django.contrib.auth.context_processors.auth', 'django.template.context_processors.debug', 'django.template.context_processors.i18n', 'django.template.context_processors.media', 'django.template.context_processors.static', 'django.template.context_processors.tz', 'django.contrib.messages.context_processors.messages']}}] TEST_NON_SERIALIZED_APPS = [] TEST_RUNNER = 'django.test.runner.DiscoverRunner' THICK_CLIENT_LOCATION = '/opt/Specify' THOUSAND_SEPARATOR = ',' TIME_FORMAT = 'P' TIME_INPUT_FORMATS = ['%H:%M:%S', '%H:%M:%S.%f', '%H:%M'] TIME_ZONE = 'America/Chicago' USE_I18N = True USE_L10N = True USE_THOUSAND_SEPARATOR = False USE_TZ = False USE_X_FORWARDED_HOST = False USE_X_FORWARDED_PORT = False VERSION = 'next-release(debug)' WB_UPLOAD_LOG_DIR = '/home/specify/wb_upload_logs' WEB_ATTACHMENT_COLLECTION = None WEB_ATTACHMENT_KEY = '****' WEB_ATTACHMENT_REQUIRES_KEY_FOR_GET = '****' WEB_ATTACHMENT_URL = None WSGI_APPLICATION = None X_FRAME_OPTIONS = 'SAMEORIGIN' YEAR_MONTH_FORMAT = 'F Y'

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 page generated by the handler for this status code.

benanhalt commented 3 years ago

There was a size limit of 50 set on that pick list. I have removed it. See #1025