ClockworkLynx / kytten

Automatically exported from code.google.com/p/kytten
7 stars 0 forks source link

Theme.__getitem__ not dealing with non-existent paths that are lists #9

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Issue #8 pointed out a problem with the exception hander in Theme.__getitem__. 
The line 
kytten/theme.py:390 looks like:

        if key.startswith('image'):

But probably wants to look like:

        if key[-1].startswith('image'):

Since the key is a path, which for the colour selector at least seems to be a 
list.

Original issue reported on code.google.com by michael....@gmail.com on 29 Dec 2009 at 12:41

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I doubt this is related to the issue you've raised, but I came across this bug 
while looking for the answer to a problem that is raised on the same line of 
code.

I got the same error running the demo.

<snip> kytten/theme.py", line 389, in __getitem__
    if key.startswith('image'):
AttributeError: 'list' object has no attribute 'startswith'

The problem was I was including the "theme.json" in the theme path argument.

theme = kytten.Theme( 
            os.path.join(
                os.getcwd(),
                'theme/theme.json'
                )
            )

What you're meant to do is just put the path in.

theme = kytten.Theme( 
            os.path.join(
                os.getcwd(),
                'theme'
                )
            )

This resolved the "issue".

Original comment by adam.lw....@gmail.com on 23 Aug 2012 at 1:26