Add pty= kwarg to upload_template, fixes #1082