Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #44915

Re: Making safe file names

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <bahamutzero8825@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'argument': 0.05; 'cpython': 0.05; 'encoding': 0.05; 'cache': 0.07; 'subject:file': 0.07; 'suggestions:': 0.09; 'bug': 0.12; 'suggest': 0.14; 'windows': 0.15; '"/"': 0.16; 'base64': 0.16; 'character.': 0.16; 'simple.': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'artist': 0.24; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'code': 0.31; 'allows': 0.31; 'file': 0.32; 'figure': 0.32; 'url:python': 0.33; 'noticed': 0.34; 'received:google.com': 0.35; '(e.g.,': 0.36; 'doing': 0.36; 'url:org': 0.36; 'wrong': 0.37; 'message-id:@gmail.com': 0.38; 'url:library': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'delete': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'how': 0.40; 'manually': 0.60; 'entire': 0.61; 'more': 0.64; '3.3.1': 0.84; '9.1': 0.84; 'freebsd': 0.84; 'messed': 0.84; 'subject:Making': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=ON2UFTccDNP4EokpWnoip1k02mAwVyhWDNJN/kSBjmU=; b=ZVSMcCM7phOd1qf7/EONJQh4BOclV9jRAsnoDAuwu5ODZ+/7ZozQTNSBsJMCb8+k7m plfvK1AK2w0mULV2GNg+tXt+Ykt/bPFHdGub14RxpQt2xPUwbv0tUAp8rJgaMOmvFFup BtMME49IcI/LtGQndT3QFxFboXuN2NecMk5okMTAvSQYuX5LyZwaMoqXph+HWx/K6nXI uHqWkYYbZBVcZHfJUPQDnSEL8Nyax3BSFvXg+YArVU81ELaM8EE21PO6FerzKBj8uu+2 yJiHx0+mwlIQMF9e1BFR7uvz+dRF31UUMTt+u7IzMR3nfuJ3xzipV3CORLQ4GDQfOM8G P+Gw==
X-Received by 10.236.84.6 with SMTP id r6mr4230573yhe.9.1367968227305; Tue, 07 May 2013 16:10:27 -0700 (PDT)
Date Tue, 07 May 2013 18:10:25 -0500
From Andrew Berg <bahamutzero8825@gmail.com>
User-Agent Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2
MIME-Version 1.0
To "comp.lang.python" <python-list@python.org>
Subject Re: Making safe file names
References <51895D03.4000300@gmail.com> <CAA=1kxTnyFgLW=N_7mOCNnj75qDHt8Dfd-aYUYD8deLTrUBQ4g@mail.gmail.com>
In-Reply-To <CAA=1kxTnyFgLW=N_7mOCNnj75qDHt8Dfd-aYUYD8deLTrUBQ4g@mail.gmail.com>
X-Enigmail-Version 1.5.1
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1426.1367968585.3114.python-list@python.org> (permalink)
Lines 14
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1367968585 news.xs4all.nl 15899 [2001:888:2000:d::a6]:58369
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:44915

Show key headers only | View raw


On 2013.05.07 17:18, Fábio Santos wrote:
> I suggest Base64. b64encode
> (http://docs.python.org/2/library/base64.html#base64.b64encode) and
> b64decode take an argument which allows you to eliminate the pesky "/"
> character. It's reversible and simple.
> 
> More suggestions: how about a hash? Or just use IDs from the database?
None of these would work because I would have no idea which file stores data for which artist without writing code to figure it out. If I
were to end up writing a bug that messed up a few of my cache files and noticed it with a specific artist (e.g., doing a "now playing" and
seeing the wrong tags), I would either have to manually match up the hash or base64 encoding in order to delete just that file so that it
gets regenerated or nuke and regenerate my entire cache.

-- 
CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Making safe file names Andrew Berg <bahamutzero8825@gmail.com> - 2013-05-07 18:10 -0500

csiph-web