[issue30095] HTMLCalendar allow custom classes

2017-06-06 Thread Walter Dörwald

Walter Dörwald added the comment:

Closing the issue. The patch has been merged.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30095] HTMLCalendar allow custom classes

2017-06-06 Thread Walter Dörwald

Walter Dörwald added the comment:


New changeset 8b7a4cc40e9b2f34da94efb75b158da762624015 by Walter Dörwald (Oz N 
Tiram) in branch 'master':
bpo-30095: Make CSS classes used by calendar.HTMLCalendar customizable (GH-1439)
https://github.com/python/cpython/commit/8b7a4cc40e9b2f34da94efb75b158da762624015


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30095] HTMLCalendar allow custom classes

2017-06-01 Thread Oz Tiram

Oz Tiram added the comment:

@Walter, I fixed the issues your raised, and also solved the merge conflict in 
What's New.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30095] HTMLCalendar allow custom classes

2017-06-01 Thread Walter Dörwald

Walter Dörwald added the comment:

See comments on the pull request. Also it seems that currently the pull request 
can't be merged because of merge conflicts.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30095] HTMLCalendar allow custom classes

2017-05-31 Thread Walter Dörwald

Walter Dörwald added the comment:

See my comments on the pull request: https://github.com/python/cpython/pull/1439

After you address those, IMHO this is ready to be merged.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30095] HTMLCalendar allow custom classes

2017-05-05 Thread Walter Dörwald

Walter Dörwald added the comment:

See comments on Github

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30095] HTMLCalendar allow custom classes

2017-05-03 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
stage:  -> patch review
versions: +Python 3.7 -Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30095] HTMLCalendar allow custom classes

2017-05-03 Thread Oz Tiram

Oz Tiram added the comment:

@Walter,

I implemented your suggestions plus the obvious tasks of adding tests and 
documentation.

Would be happy to hear your feedback.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30095] HTMLCalendar allow custom classes

2017-05-03 Thread Oz Tiram

Changes by Oz Tiram :


--
pull_requests: +1537

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30095] HTMLCalendar allow custom classes

2017-04-24 Thread Oz Tiram

Oz Tiram added the comment:

Apparently, I forgot to push the second branch. It is now pushed.

I renamed the class attribute names on the v1 branch. I still need to do
the following:

 - Add docs
 - Fix existing tests and add new tests demonstrating the usage of the new 
attributes.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30095] HTMLCalendar allow custom classes

2017-04-24 Thread Oz Tiram

Oz Tiram added the comment:

@Walter,

I agree with you about consistent naming. Personally, I would prefer to name 
all the variables "styles". But I preferred not to break past compatibility 
too. So I guess we are stuck for a while with "classes". I will rename the 
variables. As for documenting that, I would also do that.
Thanks for the feedback.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30095] HTMLCalendar allow custom classes

2017-04-24 Thread Walter Dörwald

Walter Dörwald added the comment:

The second link is a 404.

For the v1 patch:

The variable names are a bit inconsistent: The first uses "classes" all others 
use "styles". This should be consistent within itself and with the existing 
code, i.e. "classes" should be used.

Also each class attribute should be preceded with a comment, explaining what 
the CSS class is used for.

As these are now made public to be overwritten by subclasses, I wonder wether 
it would make sense to document these class attributes in 
Doc/library/calendar.rst

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30095] HTMLCalendar allow custom classes

2017-04-23 Thread Oz Tiram

Oz Tiram added the comment:

@Walter, 

I implemented two possible solutions. Chronologically speaking V2 was 
implemented before V1, but it's a bit über-smart and might surprise it's
users requiring the class attributes to be some kind of iterable.

The first version is my current preferred solution.

I intentionally didn't create a PR for that yet. 

These are the branches:

https://github.com/oz123/cpython/tree/issue30095-v1
https://github.com/oz123/cpython/tree/issue30095-v2

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30095] HTMLCalendar allow custom classes

2017-04-19 Thread Walter Dörwald

Walter Dörwald added the comment:

OK, go ahead. I'm looking forward to what you come up with.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30095] HTMLCalendar allow custom classes

2017-04-19 Thread Oz Tiram

Oz Tiram added the comment:

... Using class attributes would nice, also considering that the days CSS 
classes are defined as class attributes.

I meant to write :

Using class attributes would be nicer, also considering that the days CSS 
classes are defined as class attributes.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30095] HTMLCalendar allow custom classes

2017-04-19 Thread Oz Tiram

Oz Tiram added the comment:

@doerwalter, exactly. I found myself overwriting the relevant methods too many 
times.

I usually did something like this:

class WorkCalendar(HTMLCalendar):

def formatmonthname(self, theyear, themonth, withyear=True,
style=r'class="month-head"'):
 
"""
Return a month name as a table row.
"""
monthname = super().formatmonthname(theyear, themonth, withyear)
regex = r'class\="month"'
return re.sub(regex, style, monthname, 1)


Using class attributes would nice, also considering that the days CSS classes 
are defined as class attributes.

My intention was a few more class attributes (for the month header, and month) 
and also change the existing code such that each day can have multiple CSS 
classes and not just one.

I am willing to work on a PR for that if that sounds good and there is someone 
who would be willing to merge it.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30095] HTMLCalendar allow custom classes

2017-04-19 Thread Walter Dörwald

Walter Dörwald added the comment:

IMHO this could all be done by overwriting the relevant methods.

But this might be overkill.

I think a solution might be to move the CSS classes into class attributes of 
HTMLCalendar. Customizing the CSS classes would then be done by subclassing 
HTMLCalendar and overwriting the appropriate class attributes.

Is this what you had in mind?

--
nosy: +doerwalter

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30095] HTMLCalendar allow custom classes

2017-04-18 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30095] HTMLCalendar allow custom classes

2017-04-18 Thread Oz Tiram

Oz Tiram added the comment:

Of course I can, but I can't add multiple css classes, and I forced to
have the same class for both the title of the month and the body of the month.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30095] HTMLCalendar allow custom classes

2017-04-18 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

Can't you override the `.month` css class and customize the style that way?

--
nosy: +Mariatta

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30095] HTMLCalendar allow custom classes

2017-04-18 Thread Oz Tiram

New submission from Oz Tiram:

At the moment methods like HTMLCalendar.formatmonthname and 
HTMLCalendar.formatmonth have hard coded name 'month'.

This class is pretty helpful as a good start, but if you want to customize
the styles it's not helpful.

I think it would be helpful for others too, if this would have be customize 
able.

Would you accept a PR for such thing?

--
components: Library (Lib)
messages: 291841
nosy: Oz.Tiram
priority: normal
severity: normal
status: open
title: HTMLCalendar allow custom classes
type: enhancement
versions: Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com