← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1703296] [NEW] Custom theme with templates/500.html file fails with " ValueError: need more than 1 value to unpack "

 

Public bug reported:

## This happens with Ocata (version 11.0.4.dev1), SLES12SP2, Django
1.8.14 ##

When using a custom theme with the following structure:

# find openstack_dashboard/themes/suse/
openstack_dashboard/themes/suse/
openstack_dashboard/themes/suse/templates
openstack_dashboard/themes/suse/templates/500.html
openstack_dashboard/themes/suse/_variables.scss
openstack_dashboard/themes/suse/img
openstack_dashboard/themes/suse/img/favicon.ico
openstack_dashboard/themes/suse/img/logo.png
openstack_dashboard/themes/suse/img/logo-splash.png
openstack_dashboard/themes/suse/_styles.scss


Running the migration fails with:

# su wwwrun -s /bin/sh -c "python manage.py migrate --fake-initial --noinput"
Traceback (most recent call last):
  File "manage.py", line 23, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 303, in execute
    settings.INSTALLED_APPS
  File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 48, in __getattr__
    self._setup(name)
  File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 44, in _setup
    self._wrapped = Settings(settings_module)
  File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 92, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/srv/www/openstack-dashboard/openstack_dashboard/settings.py", line 428, in <module>
    THEME_COLLECTION_DIR, ROOT_PATH)
  File "/srv/www/openstack-dashboard/openstack_dashboard/utils/settings.py", line 330, in find_static_files
    (templates_part, override_path) = theme_file.split('/templates/')
ValueError: need more than 1 value to unpack


The reason is that file_discovery.populate_horizon_config(x, '/srv/www/openstack-dashboard/openstack_dashboard/themes/suse') populate the variable 'x' with:

{'external_templates': ['templates/500.html'], 'js_spec_files': [],
'js_files': []}

So the 'external_templates' list entries do not start with
'/templates/'. So the split of that will fail.

** Affects: horizon
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Dashboard (Horizon).
https://bugs.launchpad.net/bugs/1703296

Title:
  Custom theme with templates/500.html file fails with " ValueError:
  need more than 1 value to unpack "

Status in OpenStack Dashboard (Horizon):
  New

Bug description:
  ## This happens with Ocata (version 11.0.4.dev1), SLES12SP2, Django
  1.8.14 ##

  When using a custom theme with the following structure:

  # find openstack_dashboard/themes/suse/
  openstack_dashboard/themes/suse/
  openstack_dashboard/themes/suse/templates
  openstack_dashboard/themes/suse/templates/500.html
  openstack_dashboard/themes/suse/_variables.scss
  openstack_dashboard/themes/suse/img
  openstack_dashboard/themes/suse/img/favicon.ico
  openstack_dashboard/themes/suse/img/logo.png
  openstack_dashboard/themes/suse/img/logo-splash.png
  openstack_dashboard/themes/suse/_styles.scss

  
  Running the migration fails with:

  # su wwwrun -s /bin/sh -c "python manage.py migrate --fake-initial --noinput"
  Traceback (most recent call last):
    File "manage.py", line 23, in <module>
      execute_from_command_line(sys.argv)
    File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
      utility.execute()
    File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 303, in execute
      settings.INSTALLED_APPS
    File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 48, in __getattr__
      self._setup(name)
    File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 44, in _setup
      self._wrapped = Settings(settings_module)
    File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 92, in __init__
      mod = importlib.import_module(self.SETTINGS_MODULE)
    File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
      __import__(name)
    File "/srv/www/openstack-dashboard/openstack_dashboard/settings.py", line 428, in <module>
      THEME_COLLECTION_DIR, ROOT_PATH)
    File "/srv/www/openstack-dashboard/openstack_dashboard/utils/settings.py", line 330, in find_static_files
      (templates_part, override_path) = theme_file.split('/templates/')
  ValueError: need more than 1 value to unpack

  
  The reason is that file_discovery.populate_horizon_config(x, '/srv/www/openstack-dashboard/openstack_dashboard/themes/suse') populate the variable 'x' with:

  {'external_templates': ['templates/500.html'], 'js_spec_files': [],
  'js_files': []}

  So the 'external_templates' list entries do not start with
  '/templates/'. So the split of that will fail.

To manage notifications about this bug go to:
https://bugs.launchpad.net/horizon/+bug/1703296/+subscriptions


Follow ups