E&S CVS Commit: PEAK - A NIS (formerly YP) URL and namespaces. A somewhat decent example of

tsarna at eby-sarna.com tsarna at eby-sarna.com
Fri Nov 22 18:38:00 EST 2002


Module Name:	PEAK
Committed By:	tsarna
Date:		Fri Nov 22 23:37:44 UTC 2002

Modified Files:
	PEAK/src/peak: peak.ini
Added Files:
	PEAK/src/peak/naming/factories: nisns.py

Log Message:
A NIS (formerly YP) URL and namespaces.  A somewhat decent example of
writing namespaces.  Good: the actual "work" is very simple one-line
calls into the nis module -- it's almost all wrapper, so details of what
it actually does doesn't distract from understanding how the contexts
and such work.  Bad: Unix-only.  Actually, Unix-with-nis-configured-only.

Anyway:

    'nis:'		namespace that you can iterate over to find
			maps, or look up a map namespace by name
    'nis:mapname'	get a map namespace, which you can iterate or
			lookup by key in
    'nis:mapname/key'	lookup key in mapname

All of the following work identically, which is kinda neat:

    naming.lookup('nis:')['passwd.byname']['tsarna']
    naming.lookup('nis:')['passwd.byname/tsarna']
    naming.lookup('nis:passwd.byname')['tsarna']
    naming.lookup('nis:passwd.byname/tsarna')

(of these, #3 would probably the most useful form in a real application)


To view diffs of this commit, you can use the following URL(s):
http://cvs.eby-sarna.com/PEAK/src/peak/peak.ini.diff?r1=1.19&r2=1.20
http://cvs.eby-sarna.com/PEAK/src/peak/naming/factories/nisns.py?rev=1.1&content-type=text/vnd.viewcvs-markup

To generate a diff of this commit:
cvs rdiff -r1.19 -r1.20 PEAK/src/peak/peak.ini
cvs rdiff -r0 -r1.1 PEAK/src/peak/naming/factories/nisns.py

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




More information about the source-changes mailing list