[GRASS-SVN] r61212 - sandbox/krejcmat/src
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jul 9 03:29:50 PDT 2014
Author: krejcmat
Date: 2014-07-09 03:29:49 -0700 (Wed, 09 Jul 2014)
New Revision: 61212
Modified:
sandbox/krejcmat/src/jinjainfo.py
Log:
save xml
Modified: sandbox/krejcmat/src/jinjainfo.py
===================================================================
--- sandbox/krejcmat/src/jinjainfo.py 2014-07-09 10:29:23 UTC (rev 61211)
+++ sandbox/krejcmat/src/jinjainfo.py 2014-07-09 10:29:49 UTC (rev 61212)
@@ -19,6 +19,37 @@
import os
from jinja2 import Environment, FileSystemLoader
+
+class OWSLibInfo():
+ def __init__(self):
+ self.mdMultiple=[]
+ self.mdSingle=[]
+
+ #self.initSingle()
+
+ def initSingle(self):
+ #=======================================================================
+ # self.mdSingle.append('identifier')
+ # self.mdSingle.append('parentidentifier')
+ #
+ # self.mdSingle.append('language')
+ # self.mdSingle.append('dataseturi')
+ # self.mdSingle.append('languagecode')
+ # self.mdSingle.append('datestamp')
+ # self.mdSingle.append('charset')
+ # self.mdSingle.append('hierarchy')
+ # self.mdSingle.append('datetimestamp')
+ # self.mdSingle.append('stdver')
+ # self.mdSingle.append('stdname')
+ # self.mdSingle.append('referencesystem')
+ # self.mdSingle.append('parentidentifier')
+ # self.mdSingle.append('identification')
+ # self.mdSingle.append('serviceidentification')
+ #=======================================================================
+ pass
+
+
+
class MdDescription():
def __init__(self,tag= None, name = None, desc = None, example = None, type = None, multi = 0, inboxmulti=None, group = None, inbox = None, multiline = None, value=[],id=[],num=None ):
@@ -33,15 +64,13 @@
self.inboxmulti=inboxmulti #multiplicity in subrotoup (in static box)
self.multiline=multiline #type of ctrl text
self.num=num
- self.value=value
- self.id=id
+ self.value=list(value)
+ self.id=list(id)
self.valueIndex=-1
self.idIndex=-1
-
+
def addValue(self,value):
-
- #print value
self.value.append(value)
self.valueIndex+=1
#print self.valueIndex
@@ -49,7 +78,6 @@
def addId(self,id):
self.id.append(id)
self.idIndex+=1
-
def getId(self):
self.idIndex-=1
@@ -74,17 +102,7 @@
self._readJinjaTags()
self._domdOWSTagStr()
- def getLinebyNum(self,num):
- n=0
- for line in self.mdOWSTagStr.splitlines():
- if n==num:
- return line
- n+=1
-
- def getItemByNum(self,num):
- dict=self.cretemdDescriptionDict('num')
- return dict[num]
-
+
def cretemdDescriptionDict(self,akey):
box={}
for md in self.mdDescription:
@@ -97,60 +115,7 @@
box[key].append(md)
return box
- def getmdDescriptionGroupByGroupsList(self):
- #make dict with key=inbox(staticbox in gui)
- box={}
- for md in self.mdDescription:
- key = md.inbox
- if key is not None:
- if key not in box:
- box.setdefault(key, [])
- box[key].append(md)
-
- #gruped by inbox
- boxGroup=[]
- boxList=[]
- for key in box:
- boxGroup = box[key]
- fgroup=[]
- for item in boxGroup:
- fgroup.append(item)
- boxList.append(fgroup)
-
- #sort boxes by group()
- groupDict={}
- for item in boxList:
- key=item[0].group
- if key not in groupDict:
- groupDict.setdefault(key, [])
- groupDict[key].append(item)
-
- #add items without box
- for md in self.mdDescription:
- ibox=md.inbox
- key=md.group
- if ibox is None:
- if key not in groupDict:
- groupDict.setdefault(key, [])
- groupDict[key].append(md)
-
- #create final list of groups which include boxes and single items.
- #The boxes include items.
- #-----group
- #---box
- #---item in box
- #---item
- group=[]
- finalList=[]
- for key in groupDict:
- group = groupDict[key]
- fgroup=[]
- for item in group:
- fgroup.append(item)
- finalList.append(fgroup)
- self.grupedList=finalList
- return finalList
-
+
def _domdOWSTagStr(self):
self.mdOWSTagStr=""
tab=0
@@ -202,7 +167,9 @@
counter+=1
except IOError as e:
print "I/O error({0}): {1}".format(e.errno, e.strerror)
+
+
def _findBetween(self, s, first, last ):
try:
start = s.index( first ) + len( first )
@@ -210,7 +177,74 @@
return s[start:end]
except ValueError:
return ""
-
-if __name__ == "__main__":
-
- main()
\ No newline at end of file
+ #===========================================================================
+ # def getLinebyNum(self,num):
+ # n=0
+ # for line in self.mdOWSTagStr.splitlines():
+ # if n==num:
+ # return line
+ # n+=1
+ #===========================================================================
+
+ #===========================================================================
+ # def getItemByNum(self,num):
+ # dict=self.cretemdDescriptionDict('num')
+ # return dict[num]
+ #===========================================================================
+
+#===============================================================================
+# def getmdDescriptionGroupByGroupsList(self):
+# #make dict with key=inbox(staticbox in gui)
+# box={}
+# for md in self.mdDescription:
+# key = md.inbox
+# if key is not None:
+# if key not in box:
+# box.setdefault(key, [])
+# box[key].append(md)
+#
+# #gruped by inbox
+# boxGroup=[]
+# boxList=[]
+# for key in box:
+# boxGroup = box[key]
+# fgroup=[]
+# for item in boxGroup:
+# fgroup.append(item)
+# boxList.append(fgroup)
+#
+# #sort boxes by group()
+# groupDict={}
+# for item in boxList:
+# key=item[0].group
+# if key not in groupDict:
+# groupDict.setdefault(key, [])
+# groupDict[key].append(item)
+#
+# #add items without box
+# for md in self.mdDescription:
+# ibox=md.inbox
+# key=md.group
+# if ibox is None:
+# if key not in groupDict:
+# groupDict.setdefault(key, [])
+# groupDict[key].append(md)
+#
+# #create final list of groups which include boxes and single items.
+# #The boxes include items.
+# #-----group
+# #---box
+# #---item in box
+# #---item
+# group=[]
+# finalList=[]
+# for key in groupDict:
+# group = groupDict[key]
+# fgroup=[]
+# for item in group:
+# fgroup.append(item)
+# finalList.append(fgroup)
+# self.grupedList=finalList
+# return finalList
+#===============================================================================
+
\ No newline at end of file
More information about the grass-commit
mailing list