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

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Dec 21 10:44:43 EST 2009


Author: scottmk
Date: 2009-12-21 10:44:40 -0500 (Mon, 21 Dec 2009)
New Revision: 15206

Modified:
   trunk/Open-ILS/src/c-apps/idlval.c
Log:
1. It's okay for a virtual field not to have a datatype.

2. The "array_position" attribute is flagged by a warning
as deprecated.

M    Open-ILS/src/c-apps/idlval.c


Modified: trunk/Open-ILS/src/c-apps/idlval.c
===================================================================
--- trunk/Open-ILS/src/c-apps/idlval.c	2009-12-21 14:30:49 UTC (rev 15205)
+++ trunk/Open-ILS/src/c-apps/idlval.c	2009-12-21 15:44:40 UTC (rev 15206)
@@ -1038,9 +1038,17 @@
 	@return 1 if errors found, or 0 if not.
 
 	Rules:
-	- id attribute must be present with a non-empty value.
+	- attribute names are limited to: "name", "virtual", "label", "datatype", "array_position",
+	"selector", "i18n", "primitive".
+	- "name" attribute is required.
 	- label attribute, if present, must have a non-empty value.
-	- virtual attribute, if present, must have a value of "true" or "false".
+	- virtual and i18n attributes, if present, must have a value of "true" or "false".
+	- if the datatype attribute is present, its value must be one of: "bool", "float", "id",
+	"int", "interval", "link", "money", "number", "org_unit", "text", "timestamp".
+
+	Warnings:
+	- A non-virtual field should have a datatype attribute.
+	- Attribute "array_position" is deprecated.
 */
 static int val_one_field( Class* class, const char* id, xmlNodePtr field ) {
 	int rc = 0;
@@ -1087,7 +1095,9 @@
 			xmlFree( dt_str );
 			// To do: make sure that the namespace is reporter
 		} else if( !strcmp( attr_name, "array_position" ) ) {
-			;  // Ignore for now, but it should be deprecated
+			printf( "Line %ld: WARNING: Deprecated array_position attribute "
+					"for field \"%s\" in class \"%s\"\n",
+					xmlGetLineNo( field ), ((char*) field_name ? : ""), id );
 		} else if( !strcmp( attr_name, "selector" ) ) {
 			;  // Ignore for now
 		} else if( !strcmp( attr_name, "i18n" ) ) {
@@ -1116,7 +1126,7 @@
 		attr = attr->next;
 	}
 
-	if( warn && DT_NONE == datatype ) {
+	if( warn && (!is_virtual) && DT_NONE == datatype ) {
 		printf( "Line %ld: WARNING: No datatype attribute for field \"%s\" in class \"%s\"\n",
 			xmlGetLineNo( field ), ((char*) field_name ? : ""), id );
 	}



More information about the open-ils-commits mailing list