[viewvc-dev] Toggling of ignore whitespace from GUI

Bjørn Tore Hagen <[email protected]> Mon, 7 Apr 2014 11:10:18 +0200
Newsgroups gmane.comp.version-control.cvs.viewcvs.devel
Message-ID <[email protected]>
Hello.
I did a quick patch to our ViewVC install. Thought i=E2=80=99d share it wit=
h you just in case you find=20
it interesting. I have no clue as to if this adheres to your coding standar=
ds, as this was done
just in a hurry. My experience with Python is also pretty much limited to t=
his patch.

The changes are so small that I just inline the patches here.

Anyways, the change to viewvc.py
---------- snip ------------
/usr/lib/python2.4/site-packages/viewvc/lib# diff z/viewvc.py.rev.2908 view=
vc.py
80a81
>   'ignore_white'
697a699,700
>
>   "ignore_white"  : _re_validate_boolint,
3505c3508
<     diff_options['ignore_white'] =3D cfg.options.hr_ignore_white
---
>     diff_options['ignore_white'] =3D int(query_dict.get('ignore_white', c=
fg.options.hr_ignore_white));
3506a3510
>
3591a3596,3603
>   toggle_ignore_white_params =3D request.query_dict.copy();
>   ignore_white_enabled =3D int(request.query_dict.get('ignore_white', cfg=
.options.hr_ignore_white));
>   toggle_ignore_white_params['ignore_white'] =3D 1 - ignore_white_enabled
>   if (ignore_white_enabled):
>     toggle_ignore_white_text =3D "Disable ignore whitespace"
>   else:
>     toggle_ignore_white_text =3D "Enable ignore whitespace"
>
3603a3616,3617
>     'toggle_whitespace_href' : request.get_url(params=3Dtoggle_ignore_whi=
te_params),
>     'toggle_whitespace_text' : toggle_ignore_white_text,
---------- snip ------------

and a slight modification to the standard template. No icon added.

---------- snip ------------
usr/lib/python2.4/site-packages/viewvc/lib# diff z/file_header.ext.orig /us=
r/share/viewvc/templates/include/file_header.ezt
11a12
>       | <a href=3D"[toggle_whitespace_href]">[toggle_whitespace_text]</a>
---------- snip ------------

Regards

Bj=C3=B8rn Tore Hagen
System developer
Cerum AS, Norway

------------------------------------------------------
http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=3D4251&dsMessageId=3D3=
075986

To unsubscribe from this discussion, e-mail: [[email protected]=
.org].