Message248058
| Author | TheRegRunner |
|---|---|
| Recipients | TheRegRunner, docs@python, r.david.murray |
| Date | 2015-08-05.18:58:52 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1438801132.83.0.00982960038434.issue24778@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
# for the docs ... quoting of the filename when you call mailcap.findmatch()
f=";xterm;#.txt" # Shell Command Demo ... xterm will run if quote() fails
import mailcap
import random
try:
from shlex import quote
except ImportError:
from pipes import quote
d=mailcap.getcaps()
PY=''.join(random.choice('PYTHON') for i in range(100))
cmd,MIMEtype=mailcap.findmatch(d, 'text/plain', filename=PY)
while "'"+PY+"'" in cmd:
cmd=cmd.replace("'"+PY+"'",quote(f))
while PY in cmd:
cmd=cmd.replace(PY,quote(f))
print(cmd)
# less ';xterm;#.txt' |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2015-08-05 18:58:52 | TheRegRunner | set | recipients: + TheRegRunner, r.david.murray, docs@python |
| 2015-08-05 18:58:52 | TheRegRunner | set | messageid: <1438801132.83.0.00982960038434.issue24778@psf.upfronthosting.co.za> |
| 2015-08-05 18:58:52 | TheRegRunner | link | issue24778 messages |
| 2015-08-05 18:58:52 | TheRegRunner | create | |