From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,NO_DNS_FOR_FROM, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from [192.168.1.2] (unknown [101.128.125.123]) by gnuweeb.org (Postfix) with ESMTPSA id 9CD6380908; Fri, 21 Oct 2022 14:07:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1666361247; bh=S/LYN++MQODL0k7+SIOtz9OFOcIfyVSdBcqPahiGxWQ=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=YgKmO24sCoWBIj4VKNT38Yjg3e87E64EnG789IUx8Z/1aIWzF+ejlPoyLK2H0f28A F4/dA+9rain6h0QibskulLt24w8LJ+Ba/t8nn7CrdZPRo/+KkOIM8geZ8FlBa3vZLM Hxg7l47qs3pc0E8p9KO0aagg2hfwj3etWETE16bDvSB1OXj6OSa6EX2yrnn2cuyTT/ uHj7Rgr877kZj/dGOiTJWWG3ZXxnvCGfZM1F58IofgDQTPaHmxhc+Mmc2CppfTqVlq lJ3THGfBQG9PK+tY8J0MSEa8NWvdUff3H0beP+tJSY2amAkNOr2K+xb11hIMVZytl+ BfeAu0bDpCFRA== Message-ID: Date: Fri, 21 Oct 2022 21:07:22 +0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Subject: Re: [PATCH v3 5/9] atom: add manage_payload() Content-Language: en-US To: Ammar Faizi Cc: Alviro Iskandar Setiawan , GNU/Weeb Mailing List References: <20221021134520.701-1-kiizuha@gnuweeb.org> <20221021134520.701-6-kiizuha@gnuweeb.org> <6a9ebeeb-9227-96bb-a8d5-caceb54e54ca@gnuweeb.org> <473f96db-cc7a-f867-bb6f-aa2acbea3677@gnuweeb.org> From: Muhammad Rizki In-Reply-To: <473f96db-cc7a-f867-bb6f-aa2acbea3677@gnuweeb.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: On 21/10/2022 21.06, Ammar Faizi wrote: > On 10/21/22 9:02 PM, Muhammad Rizki wrote: >> On 21/10/2022 21.01, Ammar Faizi wrote: >>> On 10/21/22 8:45 PM, Muhammad Rizki wrote: >>>> +def manage_payload(payload: Message): >>>> +    p = str(payload.get_payload()) >>>> +    tf_encode = payload.get("Content-Transfer-Encoding") >>>> + >>>> +    if tf_encode == "base64": >>>> +        return b64decode(p).decode("utf-8") >>>> +    if tf_encode == "quoted-printable": >>>> +        return quopri.decodestring(p.encode()).decode() >>>> + >>>> +    return p.encode().decode("utf-8", errors="replace") >>> >>> I don't feel strongly about this helper name. What about name it >>> with get_decoded_paylaod()? >>> >> >> Sure, or just decode_payload()? > > Since you pass a Message object and it contains headers and body, > I prefer to emphasize the "get". So I still prefer the name > get_decoded_paylaod() for this function. What we call payload is > the body anyway. > OK.