Skip to content

Python3 support (work in progress).#10

Open
skakri wants to merge 2 commits intopetercollingridge:masterfrom
skakri:python3
Open

Python3 support (work in progress).#10
skakri wants to merge 2 commits intopetercollingridge:masterfrom
skakri:python3

Conversation

@skakri
Copy link
Copy Markdown

@skakri skakri commented Jan 31, 2015

Python 3 support.

Adjusted code to conform to pep8 standard.
Removed trailing whitespace.
@skakri
Copy link
Copy Markdown
Author

skakri commented Jan 31, 2015

Hi, Peter.

This pull request is work in progress to keep you up to date with the changes I've implemented/intending to implement.

I've stumbled upon your project and wanted to use it in my application, which uses Python3 (my scope is – upload SVG, clean it up, remove styles and style it via external, generated CSS).

This is a stub to add Python 3 support. I intend to use six compatibility layer, to keep Python 2 support.

I've also renamed internal/external functions, to use underscored naming. If you think that this change could break users' code, we could add camelCased function aliases with deprecation messages. I'd like to also rename module name (file cleanSVG.py) to clean_svg if you don't mind.

Also I wish to implement two extra (optional) named parameters to extract_styles method – in my use case I need to strip fill style and keep others (I wish to change fill style via external CSS dynamically). Parameters are as folows:
- internal (boolean) – if True (default, same as current behaviour) – store styles in SVG file in class, False – omits _add_style_element function call and adds generated CSS to instance.stylesheet instead so SVG and styles can be used separately.
- strip (list) – if defined (defaults to empty list) – strips these styles completely. They won't be available in instance.stylesheet if called with internal parameter.

I need this to be implemented "as soon as possible"™, so I'm going to make a sub-branch from this one and rebase later, if that's okay.

I'm open to comments and suggestions.

@skakri
Copy link
Copy Markdown
Author

skakri commented Jan 31, 2015

I just checked, actually these changes work with Python 2 just fine (tests would be great though, as I've tested with only a couple of SVGs).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant