on removing constants

David Leonard david.leonard at dstc.edu.au
Sun Dec 10 14:28:54 CET 2000


On Thu, 16 Nov 2000, Jeffrey C. Ollie typed thusly:

> I've gotten today's CVS version to compile against OpenLDAP 2.0.7.  It
> seems that the OpenLDAP people dropped a number of macros between v1
> and v2.  A fairly simple patch that #ifdefs the dropped macros and
> everything compiles fine.

I think it will be more beneficial to just remove those dead constants from
the python namespace altogether.

Does anyone ever use them? Here's the list

	MAX_ATTR_LEN
	REQ_UNBIND_30
	REQ_DELETE_30
	REQ_ABANDON_30
	AUTH_SIMPLE_30
	AUTH_KRBV41_30
	AUTH_KRBV42_30
	FILTER_PRESENT_30
	SUBSTRING_INITIAL_30
	SUBSTRING_ANY_30
	SUBSTRING_FINAL_30
	URL_ERR_NOTLDAP
	URL_ERR_NODN

	CACHE_BUCKETS
	CACHE_OPT_CACHENOERRS
	CACHE_OPT_CACHEALLERRS

	DEFAULT_REFHOPLIMIT
	OPT_DNS
	OPT_REFERRALS

Does anyone even use the cache control stuff?
If you do, I will suggest that the future cache calls be of the form
	l.set_cache_options("noerrs", "blah")
Instead of
	l.set_cache_options(_ldap.CACHE_OPT_CACHENOERRS | _ldap.BLAH)
It reads a bit easier too. comments?

What about the referrals and DNS options? someone must, surely :)
i think also that a string-base approach would be better there too.
	>>> l.options
	("restart",)
	>>> l.options = l.options + "referrals",
	>>> l.options
	("referrals", "restart")
	>>> l.options = l.options + "snork",	# silently ignored??
	("referrals", "restart")

i've been talking to michael stroeder about getting all these things
together in a clean way for a '2.0' release of python-ldap. this means
that strong changes like the above are quite possible.

d
-- 
David Leonard                           David.Leonard at dstc.edu.au
DSTC                                    Room:78-632  Ph:+61 7 336 58358
The University of Queensland            http://www.dstc.edu.au/
QLD 4072  AUSTRALIA                     B73CD65FBEF4C089B79A8EBADF1A932F13EA0FC8

I put my chin on my knee, and looked for flaws in the soft grain of my
beige plastic monitor casing. - Julian Assange


Index: constants.c
===================================================================
RCS file: /cvsroot/python-ldap/python-ldap/Modules/constants.c,v
retrieving revision 1.5
diff -u -r1.5 constants.c
--- constants.c	2000/08/13 15:00:59	1.5
+++ constants.c	2000/12/10 13:07:58
@@ -66,7 +66,7 @@
 	add_int(d,VERSION1);
 	add_int(d,VERSION2);
 	add_int(d,VERSION);
-	add_int(d,MAX_ATTR_LEN);
+	/* add_int(d,MAX_ATTR_LEN); */
 	add_int(d,TAG_MESSAGE);
 	add_int(d,TAG_MSGID);

@@ -79,9 +79,9 @@
 	add_int(d,REQ_MODRDN);
 	add_int(d,REQ_COMPARE);
 	add_int(d,REQ_ABANDON);
-	add_int(d,REQ_UNBIND_30);
-	add_int(d,REQ_DELETE_30);
-	add_int(d,REQ_ABANDON_30);
+	/* add_int(d,REQ_UNBIND_30); */
+	/* add_int(d,REQ_DELETE_30); */
+	/* add_int(d,REQ_ABANDON_30); */

 	/* reversibles */

@@ -106,9 +106,9 @@
 	add_int(d,AUTH_KRBV4);
 	add_int(d,AUTH_KRBV41);
 	add_int(d,AUTH_KRBV42);
-	add_int(d,AUTH_SIMPLE_30);
-	add_int(d,AUTH_KRBV41_30);
-	add_int(d,AUTH_KRBV42_30);
+	/* add_int(d,AUTH_SIMPLE_30); */
+	/* add_int(d,AUTH_KRBV41_30); */
+	/* add_int(d,AUTH_KRBV42_30); */
 	add_int(d,FILTER_AND);
 	add_int(d,FILTER_OR);
 	add_int(d,FILTER_NOT);
@@ -118,13 +118,13 @@
 	add_int(d,FILTER_LE);
 	add_int(d,FILTER_PRESENT);
 	add_int(d,FILTER_APPROX);
-	add_int(d,FILTER_PRESENT_30);
+	/* add_int(d,FILTER_PRESENT_30); */
 	add_int(d,SUBSTRING_INITIAL);
 	add_int(d,SUBSTRING_ANY);
 	add_int(d,SUBSTRING_FINAL);
-	add_int(d,SUBSTRING_INITIAL_30);
-	add_int(d,SUBSTRING_ANY_30);
-	add_int(d,SUBSTRING_FINAL_30);
+	/* add_int(d,SUBSTRING_INITIAL_30); */
+	/* add_int(d,SUBSTRING_ANY_30); */
+	/* add_int(d,SUBSTRING_FINAL_30); */
 	add_int(d,SCOPE_BASE);
 	add_int(d,SCOPE_ONELEVEL);
 	add_int(d,SCOPE_SUBTREE);
@@ -135,34 +135,24 @@

 	/* (errors.c contains the error constants) */

-	add_int(d,DEFAULT_REFHOPLIMIT);
-#ifdef LDAP_CACHE_BUCKETS
-	add_int(d,CACHE_BUCKETS);
-#endif
-#ifdef LDAP_CACHE_OPT_CACHENOERRS
-	add_int(d,CACHE_OPT_CACHENOERRS);
-#endif
-#ifdef LDAP_CACHE_OPT_CACHEALLERRS
-	add_int(d,CACHE_OPT_CACHEALLERRS);
-#endif
+	/* add_int(d,DEFAULT_REFHOPLIMIT); */
+	/* add_int(d,CACHE_BUCKETS); */
+	/* add_int(d,CACHE_OPT_CACHENOERRS); */
+	/* add_int(d,CACHE_OPT_CACHEALLERRS); */
 	add_int(d,FILT_MAXSIZ);
 	add_int(d,DEREF_NEVER);
 	add_int(d,DEREF_SEARCHING);
 	add_int(d,DEREF_FINDING);
 	add_int(d,DEREF_ALWAYS);
 	add_int(d,NO_LIMIT);
-#ifdef LDAP_OPT_DNS
-	add_int(d,OPT_DNS);
-#endif
-#ifdef LDAP_OPT_REFERRALS
-	add_int(d,OPT_REFERRALS);
-#endif
+	/* add_int(d,OPT_DNS); */
+	/* add_int(d,OPT_REFERRALS); */
 	add_int(d,OPT_RESTART);

 	/* XXX - these belong in errors.c */

-	add_int(d,URL_ERR_NOTLDAP);
-	add_int(d,URL_ERR_NODN);
+	/* add_int(d,URL_ERR_NOTLDAP); */
+	/* add_int(d,URL_ERR_NODN); */
 	add_int(d,URL_ERR_BADSCOPE);
 	add_int(d,URL_ERR_MEM);






More information about the python-ldap mailing list