[GRASS-SVN] r47290 - grass-addons/grass7/gui/wxpython/wx.wms
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jul 28 03:25:20 EDT 2011
Author: sudeepsingh
Date: 2011-07-28 00:25:20 -0700 (Thu, 28 Jul 2011)
New Revision: 47290
Added:
grass-addons/grass7/gui/wxpython/wx.wms/ServerInfoAPIs.py
Modified:
grass-addons/grass7/gui/wxpython/wx.wms/bgenerateDOM.py
Log:
remove an entry functioanlity added
Added: grass-addons/grass7/gui/wxpython/wx.wms/ServerInfoAPIs.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.wms/ServerInfoAPIs.py (rev 0)
+++ grass-addons/grass7/gui/wxpython/wx.wms/ServerInfoAPIs.py 2011-07-28 07:25:20 UTC (rev 47290)
@@ -0,0 +1,35 @@
+from BeautifulSoup import BeautifulSoup, Tag, BeautifulStoneSoup
+
+def addServerInfo(soup, serverinfo, snamevalue, urlvalue, unamevalue, passwordvalue):
+
+ server = Tag(soup, "server")
+ serverinfo.insert(0,server)
+
+ #Creating server info tags
+ servername = Tag(soup, "servername")
+ serverurl = Tag(soup, "serverurl")
+ username = Tag(soup, "username")
+ password = Tag(soup, "password")
+
+ #Inserting server info fields
+ server.insert(0, servername)
+ server.insert(1, serverurl)
+ server.insert(2, username)
+ server.insert(3, password)
+
+ #Adding attribute to server tag
+ server['id'] = snamevalue
+
+ #Adding text values to the server info fields
+ servername.insert(0,snamevalue)
+ serverurl.insert(0, urlvalue)
+ username.insert(0, unamevalue)
+ password.insert(0, passwordvalue)
+
+def removerServerInfo(soup, serverID):
+ elements = soup.findAll(id = serverID)
+ for element in elements:
+ element.extract()
+
+
+
\ No newline at end of file
Modified: grass-addons/grass7/gui/wxpython/wx.wms/bgenerateDOM.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.wms/bgenerateDOM.py 2011-07-28 06:13:10 UTC (rev 47289)
+++ grass-addons/grass7/gui/wxpython/wx.wms/bgenerateDOM.py 2011-07-28 07:25:20 UTC (rev 47290)
@@ -1,32 +1,6 @@
from BeautifulSoup import BeautifulSoup, Tag, NavigableString, BeautifulStoneSoup
+from ServerInfoAPIs import addServerInfo, removerServerInfo
-
-def addServerInfo(soup, serverinfo, snamevalue, urlvalue, unamevalue, passwordvalue):
-
- server = Tag(soup, "server")
- serverinfo.insert(0,server)
-
- #Creating server info tags
- servername = Tag(soup, "servername")
- serverurl = Tag(soup, "serverurl")
- username = Tag(soup, "username")
- password = Tag(soup, "password")
-
- #Inserting server info fields
- server.insert(0, servername)
- server.insert(1, serverurl)
- server.insert(2, username)
- server.insert(3, password)
-
- #Adding attribute to server tag
- server['id'] = snamevalue
-
- #Adding text values to the server info fields
- servername.insert(0,snamevalue)
- serverurl.insert(0, urlvalue)
- username.insert(0, unamevalue)
- password.insert(0, passwordvalue)
-
try:
f = open('out.xml','r+')
xml = f.read()
@@ -40,18 +14,10 @@
if(len(serverinfolist) == 0):
serverinfo = Tag(soup, "serverinfo")
soup.insert(0, serverinfo)
-
-
+
+addServerInfo(soup, soup.serverinfo, 'a1', 'b1', 'c1', 'd1')
addServerInfo(soup, soup.serverinfo, 'a2', 'b2', 'c2', 'd2')
-
+removerServerInfo(soup, "a2")
xml = soup.prettify()
-
-#f = open('out.xml','w')
f.write(xml)
f.close()
-
-
-
-#xml = "<doc><tag1>Contents 1<tag2>Contents 2<tag1>Contents 3"
-soup1 = BeautifulStoneSoup(xml)
-print soup1.prettify()
\ No newline at end of file
More information about the grass-commit
mailing list