annotate roundup/anypy/urllib_.py @ 7800:2d4684e4702d

fix: enhancement to history command output and % template fix. Rather than using the key field, use the label field for descriptions. Call cls.labelprop(default_to_id=True) so it returns id rather than the first sorted property name. If labelprop() returns 'id' or 'title', we return nothing. 'id' means there is no label set and no properties named 'name' or 'title'. So have the caller do whatever it wants (prepend classname for example) when there is no human readable name. This prevents %(name)s%(key)s from producing: 23(23). Also don't accept the 'title' property. Titles can be too long. Arguably we could: '%(name)20s' to limit the title length. However without ellipses or something truncating the title might be confusing. So again pretend there is no human readable name.
author John Rouillard <rouilj@ieee.org>
date Tue, 12 Mar 2024 11:52:17 -0400
parents d5d7ecd31864
children 5c5723cd721a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4362
74476eaac38a more modernisation
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
1
74476eaac38a more modernisation
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
2 try:
4996
dfd0bcc947e5 Add comments about supported anypy python versions
John Kristensen <john@jerrykan.com>
parents: 4362
diff changeset
3 # Python 3+
7767
d5d7ecd31864 chore: sort imports w/ ruff.
John Rouillard <rouilj@ieee.org>
parents: 7228
diff changeset
4 from urllib.parse import parse_qs, quote, unquote, urlencode, \
d5d7ecd31864 chore: sort imports w/ ruff.
John Rouillard <rouilj@ieee.org>
parents: 7228
diff changeset
5 urlparse, urlunparse
5402
88dbacd11cd1 Python 3 preparation: update urllib / urllib2 / urlparse imports.
Joseph Myers <jsm@polyomino.org.uk>
parents: 5121
diff changeset
6 from urllib.request import urlopen
6023
7b194e35d332 flak8 fixes: replace bare except with except ImportError
John Rouillard <rouilj@ieee.org>
parents: 5402
diff changeset
7 except ImportError:
4996
dfd0bcc947e5 Add comments about supported anypy python versions
John Kristensen <john@jerrykan.com>
parents: 4362
diff changeset
8 # Python 2.5-2.7
7767
d5d7ecd31864 chore: sort imports w/ ruff.
John Rouillard <rouilj@ieee.org>
parents: 7228
diff changeset
9 from urllib import quote, unquote, urlencode # noqa: F401
d5d7ecd31864 chore: sort imports w/ ruff.
John Rouillard <rouilj@ieee.org>
parents: 7228
diff changeset
10
d5d7ecd31864 chore: sort imports w/ ruff.
John Rouillard <rouilj@ieee.org>
parents: 7228
diff changeset
11 from urllib2 import urlopen # noqa: F401
d5d7ecd31864 chore: sort imports w/ ruff.
John Rouillard <rouilj@ieee.org>
parents: 7228
diff changeset
12 from urlparse import parse_qs, urlparse, urlunparse # noqa: F401

Roundup Issue Tracker: http://roundup-tracker.org/