Error Message

ValueErrorunpack tuple of wrong size

Steps to reproduce

Using moin-1.3.3 on SLES 9 system in standalone mode. I completed default Wiki installation in my home directory.
I downloaded the rightsidebarsmaller theme from ThemeMarket and completed the theme installation as described
in HelpOnThemes. When I restarted my Wiki I received the following error.
ValueErrorunpack tuple of wrong size

Theme:

http://moinmoin.wikiwikiweb.de/ThemeMarket?action=AttachFile&do=get&target=rightsidebarsmaller1.3.1.tgz

Version Info

Python Python 2.3.3: /usr/bin/python
Linux dl320 2.6.5-7.145-smp #1 SMP Thu Jan 27 09:19:29 UTC 2005 i686
MoinMoin Release 1.3.3 [Revision 1.3.3 release]
Thu Feb 24 15:03:24 2005

Error Code

WikiError.html

Details

MoinMoin Version

1.3.3

OS and Version

SLES 9

Python Version

2.3.3

Server Setup

Standalone

Server Details

none

Workaround

None

Discussion

We should not break an API such easily. The loop should accept both formats.

No, don't mess our code with backward compatibility. The author should simply fix his theme, in this case, its simple as REMOVING the stylesheets variable from the theme.

The purpose of the patch that changed that API was to eliminate the need to use such stylesheets variable. -- NirSoffer 2005-02-24 22:58:43

There is now a 1.3.3 package on ThemeMarket. I think we can close this, as this is history, nobody should run older versions of 1.3.3, and we can't support this.

What causes this bug? My personal theme causes the same error upon my upgrade to 1.3.3. I'd like to fix it because I was about to upload it... Thanks. -- EduardoMercovich 2005-03-08 18:17:41


Ok, this is related, so I'll ask here. All of my themes that I've made, from 1.2.x to 1.3.1 were based off another theme, originally Classic but recently Modern. I would use this line of code to import the original theme:

from MoinMoin.theme.modern import Theme as ThemeBase

...and then proceed to modify the few colors and such that I wanted, since I like to color code each wiki (seperate one for each project) and not spend much time on it. I removed the stylesheet lines, and at least the pages load now, but I can't seem to import the other theme as a base. I downloaded all the 1.3.3 example themes, and all of them have duplicated all of the original css files and just changed what they need. This does not work for me, as I don't want to (and can't even think of a good way, not being a programmer) merge later changes from the modern theme, and have 5 different themes to maintain, when all I want to do is change a few colors between them.

Any suggestions? Should this still work? Was this functionality removed for some reason? Replaced with another function I don't know about?

-- JamesGreen

There is no problem to subclass the existing themes. Here is a working example:

  1. Create this file at wiki/data/plugin/theme/subclass.py
    • from MoinMoin.theme import modern
      
      class Theme(modern.Theme):
          name = 'subclass'
      The new theme is exactly the same as modern, except the name.
  2. Clone modern htdocs directory:
    • cp -r /prefix/share/moin/htdocs/modern /prefix/share/moin/htdocs/subclass

Any theme you make will have to include complete htdocs directory, as we did now want to make new themes depend on other themes, and it is very easy and does not take any space to copy the directories.

If you want to offer your users many custom themes, you will have to maintain and update the themes each time there is a new version. This is of course crazy, and I would not recommend it to anyone. A sane solution is to offer only one theme for all your wikis, probably customized to your needs. If you want to use color coding, use the wiki logo or page_header1, page_header2, page_footer1, page_footer2 configuration options.

For example, add this to your config:

    page_header1 = '<div style="height: 5px; background: red;"></div>'

See example here: Red Wiki, Blue Wiki, Green Wiki,

-- NirSoffer 2005-03-21 03:05:28

Ah, ok, see how it works. This is what I figured, I was just hoping it wasn't this way. Unfortunately my customization to the Modern theme is quite extensive, too much for updating those config variables. I change the colors of just about everything, and sizes of fonts too. Background images for the top and bottom, margin adjustments, lots of stuff.

I do understand that you don't want people to extend themes since they may break later, but personally I see more benefit to allowing this behavior than restricting it. Are you sure there's no compromize? Unfortunately I will probably have to propogate my changes across 5 different themes now, plus it locks me to the current version of the Modern theme, and I won't get any fixes incorperated into newer versions.

-- JamesGreen

I did not write that I don't want people to extend themes. Themes can be easily extended - either by sub classing or by cloning. If you subclass the theme, you get automatically any new feature and fixes in the python code, but of course anything you override will not use new features and fixes.

The styles sheets and images are separate for each theme, although you can override the methods that create the stylesheets links, and use other themes stylesheets with your own stylessheets. For example, add your own stylesheet that override rules in the previous stylesheets. This will make you theme depend on the other theme and it might break if we change the other theme.

If you are going to change almost everything in all themes, you will have a lot of work, simply because this is a lot of work, we can do nothing about it, and it was exactly the same if not harder on previous versions. My advice is - provide one good theme for your site that work well with your site design.

-- NirSoffer 2005-03-21 16:08:05

Ok, I understand. Not being a programmer, I just used an example theme that exteneded a base theme and continuted to use that forever. Now that seems to have changed somewhat, and all of the 1.3.3 themes do not use this "inheriting" method, so I didn't know how to make it work.

A programmer friend of mine has offered to help me out and add some code to make the themes work like they did pre-1.3.2. I probably shouldn't have been mucking with it this much without having programming skills to bail me out. :) Thanks for the explanation though. (I'll take my chances with subclassing, it worked fine for 2.5 years)

-- JamesGreen

I suspect there is some misunderstanding here. Maybe open a page and try to describe exactly what you want to get, how you did it in previous versions (attach your old themes) and what does not work for you now. Maybe we can fix your problem easily, or change the themes code to make it easier to extend. -- NirSoffer 2005-03-22 13:59:22

(not sure what new page to make, so I'll keep writing here but feel free to move it to where you think it belongs)

Ok, this is probably bad form, but this is what the file in my \Python23\Lib\site-packages\MoinMoin\theme folder (objective_force.py) contained:

# -*- coding: iso-8859-1 -*-
"""
    MoinMoin Objective Force theme.

    @copyright: 2004 by James Green jgreen@ubisoft.com
    @license: GNU GPL, see COPYING for details.
"""

from MoinMoin import config
from MoinMoin.theme.modern import Theme as ThemeBase

class Theme(ThemeBase):
    """ This is the Objective Force theme. """

    name = 'objective_force'
    

    stylesheets = ThemeBase.stylesheets + (
        # theme charset         media       basename
        (name,  'iso-8859-1',   'screen',   'objective_force'),
    )

def execute(request):
    return Theme(request)

All that I have in the \Python23\share\moin\htdocs\objective_force\css folder is objective_force.css, along with some images used for that theme. This worked in 1.3.1. I upgraded to 1.3.4, and everything broke, with the error desribed by the other person at the top of the page. I removed the stylesheets variable, and now the page loaded, but was horribly broken. I assume this is because it isn't doing what it did before--start with the Modern theme, and override certain attributes with my new ones, like this:

html {
        background-color: #EEECE1;
        color: #424242;
        font-family: Arial, Lucida Grande, sans-serif;
        font-size: 0.95em;
        line-height: 1.25em;
}

#page {
        background-color: #EEECE1;
}
table
{
        background: #E3E0CC;
}

td
{
        border: 1pt solid #BBBBBB;
}

#credits {
    margin: 0;
    padding: 0;
    text-align: right;
    background: #343434;
    background-image: url(of_bottom.jpg); /* background image for very bottom of page */
    height: 22px;
}

pre {                               /* for preformated text */
        border: 1pt solid #DDCB99;
        background-color: #E8DEB4;
}

That's just a tiny part of it, there's much more of course. Actually what I really should do is extend Modern with the global changes I want, then extend it again with the specific header/footer images and color schemes for each wiki. See what I'm getting at? I'm not sure if I messed something up, if the code was "fixed" to keep this from happening, or some functionality was broken somewhere by accident. Any ideas? Thanks for listening to my ramblings. :) -- JamesGreen

Now its clear. You want to subclass modern, and override or add certain css rules. This is done little differently in 1.3.3 and later. Themes do not reference each other now, but only one theme files - all the css files are served from the themename/css directory. In 1.3.3 and later is little harder to extend in this way, but easier to create new themes, which is probably the common case. Now you don't have to use stylesheets variables for new themes, unless you want to change the default behavior.

To get the same effect:

  1. Copy modern stylesheets to your theme css directory
    • cd /prefix/share/moin/htdocs/
      cp modern/css/* themename
  2. Create your /prefix/share/moin/htdocs/modern/css/screen-override.css file - note that now all css file are using 'utf-8', which works for all languages.

  3. Create this theme file in wiki/data/plugin/theme/themename.py. Note that files you put in /prefix/lib/python2.x/site-packages/MoinMoin/theme/ might be overwritten without any notice when you upgrade.

    •    1 from MoinMoin.theme import modern
         2 
         3 class Theme(modern.Theme):
         4     name = 'themename'
         5 
         6     # Add screen-override.css stylesheet
         7     stylesheets = modern.Theme.stylesheets + (
         8         ('screen', 'screen-override'),
         9         )
        10 
        11 
        12 def execute(request):
        13     return Theme(request)
      

Now when you upgrade to a new version, and you see that modern css was changed, and you like to add this change to your theme, copy modern css files into your theme again:

cd /prefix/share/moin/htdocs/
cp modern/css/* themename

-- NirSoffer 2005-03-23 12:41:16

Plan

Document the api change on ApiChanges


CategoryMoinMoinNoBug

MoinMoin: MoinMoinBugs/Pre1.3.3ThemesIncompatibility (last edited 2007-10-29 19:18:11 by localhost)