#NEWLINE# def sync_geoserver( path ) : #NEWLINE# #INDENT# file = urlopen ( ( path + '?SERVICE=WFS&REQUEST=GetCapabilities' ) ) #NEWLINE# buffer = file . read ( ) #NEWLINE# soup = BeautifulStoneSoup ( buffer ) #NEWLINE# layers = soup . findAll ( name = 'featuretype' ) #NEWLINE# results = [ ] #NEWLINE# for l in layers : #NEWLINE# #INDENT# name = l . find ( 'title' ) #NEWLINE# id = l . find ( 'name' ) #NEWLINE# if ( name and id ) : #NEWLINE# #INDENT# text = k . string #NEWLINE# if ( not text ) : #NEWLINE# #INDENT# text = id . string #NEWLINE# #UNINDENT# m = match ( '^([^\\:]+)\\:(.+)$' , id . string ) #NEWLINE# if m : #NEWLINE# #INDENT# p = m . group ( 1 ) #NEWLINE# f = m . group ( 2 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# p = ( '' , ) #NEWLINE# f = id . string #NEWLINE# #UNINDENT# if dm . query ( 'maps' , prefix = p , filename = f , name = text , src = path ) . first ( ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# id = dm . insert ( 'maps' , prefix = p , filename = f , name = text , src = path , public = True ) #NEWLINE# keywords = l . findAll ( name = 'keyword' ) #NEWLINE# kw = [ ] #NEWLINE# for k in keywords : #NEWLINE# #INDENT# kw . append ( k . string )