Tk Library Source Code

View Ticket
Login
Ticket UUID: 1811890
Title: inifile : allow keys with no assignment
Type: Patch Version: None
Submitter: jvella23 Created on: 2007-10-11 22:36:41
Subsystem: inifile Assigned To: afaupell
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2013-07-04 17:25:21
Resolution: Not Applicable Here Closed By:
    Closed on:
Description:
First off, the "Category" list is missing "inifile".

I'm attaching a patch to allow section keys that have no assigned value, not even an empty value which is done by doing "key=". This will allow a call to the ::get function to successfully return key "C" in the following example section:

[dummy]
A=first
B=
C

A simple example of where this enhancement comes into play is if you wanted to use a section to hold a simple list of names, for example a list of valid file suffixes:

[suffix_list]
.txt
.tcl
.cxx

The ::value function was modified to return the default value for keys that exist but have no assignment. This allows distinguishing the case where a key exists and is assigned an empty value versus a key that has no assignment.

I've updated the test to cover this new capability.

The patch was made against version 1.13 of ini.tcl and includes the following file updates:

ini.tcl
inifile.test
pkgIndex.tcl
test.ini
User Comments: andreas_kupries added on 2007-10-12 05:39:06:
Logged In: YES 
user_id=75003
Originator: NO

Reassigned to author of inifile package.

jvella23 added on 2007-10-12 05:36:41:

File Added - 249291: inifile-patch.tgz

Attachments: