[open-ils-commits] r12150 - trunk/Open-ILS/src/c-apps (scottmk)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Feb 11 13:55:15 EST 2009


Author: scottmk
Date: 2009-02-11 13:55:11 -0500 (Wed, 11 Feb 2009)
New Revision: 12150

Modified:
   trunk/Open-ILS/src/c-apps/oils_cstore.c
Log:
1. Corrected the enforcement of the readonly attribute for classes.
It was backwards, but harmlessly so because the enforcement is
redundant.

2. Reversed the default for the "virtual" attribute of a field.
Formerly it defaulted to true; now it defaults to false.


Modified: trunk/Open-ILS/src/c-apps/oils_cstore.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_cstore.c	2009-02-11 17:02:19 UTC (rev 12149)
+++ trunk/Open-ILS/src/c-apps/oils_cstore.c	2009-02-11 18:55:11 UTC (rev 12150)
@@ -1309,7 +1309,9 @@
 		return jsonNULL;
 	}
 
-	if (osrfHashGet( meta, "readonly" ) && strncasecmp("true", osrfHashGet( meta, "readonly" ), 4)) {
+	// The following test is harmless but redundant.  If a class is
+	// readonly, we don't register a create method for it.
+	if( str_is_true( osrfHashGet( meta, "readonly" ) ) ) {
 		osrfAppSessionStatus(
 			ctx->session,
 			OSRF_STATUS_BADREQUEST,
@@ -3516,7 +3518,9 @@
 		return jsonNULL;
 	}
 
-	if (osrfHashGet( meta, "readonly" ) && strncasecmp("true", osrfHashGet( meta, "readonly" ), 4)) {
+	// The following test is harmless but redundant.  If a class is
+	// readonly, we don't register an update method for it.
+	if( str_is_true( osrfHashGet( meta, "readonly" ) ) ) {
 		osrfAppSessionStatus(
 			ctx->session,
 			OSRF_STATUS_BADREQUEST,
@@ -3675,7 +3679,9 @@
 		return jsonNULL;
 	}
 
-	if (osrfHashGet( meta, "readonly" ) && strncasecmp("true", osrfHashGet( meta, "readonly" ), 4)) {
+	// The following test is harmless but redundant.  If a class is
+	// readonly, we don't register a delete method for it.
+	if( str_is_true( osrfHashGet( meta, "readonly" ) ) ) {
 		osrfAppSessionStatus(
 			ctx->session,
 			OSRF_STATUS_BADREQUEST,
@@ -3787,10 +3793,10 @@
 		/* fetch the fieldmapper index */
 		if( (_f = osrfHashGet(fields, (char*)columnName)) ) {
 			
-			char* virt = (char*)osrfHashGet(_f, "virtual");
-			if ( !virt || !(strcmp( virt, "true" )) ) continue;
+			if ( str_is_true( osrfHashGet(_f, "virtual") ) )
+				continue;
 			
-			char* pos = (char*)osrfHashGet(_f, "array_position");
+			const char* pos = (char*)osrfHashGet(_f, "array_position");
 			if ( !pos ) continue;
 
 			fmIndex = atoi( pos );



More information about the open-ils-commits mailing list