# Path: webapp/model.py
# class Song(SQLObject):
# class Songbook(SQLObject):
# class Visit(SQLObject):
#     class sqlmeta:
# class VisitIdentity(SQLObject):
# class Group(SQLObject):
#     class sqlmeta:
# class User(SQLObject):
#     class sqlmeta:
# class Permission(SQLObject):
#     def lookup_visit(cls, visit_key):
#     def _get_permissions(self):
#     def _set_password(self, cleartext_password):
#     def set_password_raw(self, password):
# def bootstrap_model(clean=False, user=None):
# def create_tables(drop_all=False):
# def create_default_user(user_name):


from webapp.model import Song, Songbook, hub
from posixpath import *
  import xml.etree.cElementTree as ET
  import xml.etree.ElementTree as ET
import xml.parsers.expat
import webapp.c_utilities as c
import turbogears
import glob
import sys
import os
import re

    if dom.find('author') != None and dom.find('author').text != None:    #don't die if no author
      author = dom.find('author').text
    else:
      author = ''

    if dom.find('categories') != None and dom.find('categories').text != None:    #don't die if no categories
      categories = dom.find('categories').text
    else:
      categories = ''
    
    if dom.find('copyright') != None and dom.find('copyright').text != None:    #don't die if no copyright
      copyright = dom.find('copyright').text
    else:
      copyright = ''

    #this code is direct copy from db.py song_save
    if dom.find('chunk/line') != None: #don't die if no content
      content = ''
      for line in dom.findall('chunk/line'):
        content += re.sub('<c.*?c>', '', ET.tostring(line).replace('<line>',' ').replace('</line>',' '))
    else:
      content = ''

  except xml.parsers.expat.ExpatError:
    title = 'No title'
    author = ''
    categories = ''
    print 'MALFORMED:', path
  

# Path: webapp/model.py
# class Song(SQLObject):
# class Songbook(SQLObject):
# class Visit(SQLObject):
#     class sqlmeta:
# class VisitIdentity(SQLObject):
# class Group(SQLObject):
#     class sqlmeta:
# class User(SQLObject):
#     class sqlmeta:
# class Permission(SQLObject):
#     def lookup_visit(cls, visit_key):
#     def _get_permissions(self):
#     def _set_password(self, cleartext_password):
#     def set_password_raw(self, password):
# def bootstrap_model(clean=False, user=None):
# def create_tables(drop_all=False):
# def create_default_user(user_name):


# Path: regen_db.py
from webapp.model import Song, Songbook, hub
from posixpath import *
  import xml.etree.cElementTree as ET
  import xml.etree.ElementTree as ET
import xml.parsers.expat
import webapp.c_utilities as c
import turbogears
import glob
import sys
import os
import re


    if dom.find('author') != None and dom.find('author').text != None:    #don't die if no author
      author = dom.find('author').text
    else:
      author = ''

    if dom.find('categories') != None and dom.find('categories').text != None:    #don't die if no categories
      categories = dom.find('categories').text
    else:
      categories = ''
    
    if dom.find('copyright') != None and dom.find('copyright').text != None:    #don't die if no copyright
      copyright = dom.find('copyright').text
    else:
      copyright = ''

    #this code is direct copy from db.py song_save
    if dom.find('chunk/line') != None: #don't die if no content
      content = ''
      for line in dom.findall('chunk/line'):
        content += re.sub('<c.*?c>', '', ET.tostring(line).replace('<line>',' ').replace('</line>',' '))
    else:
      content = ''

  except xml.parsers.expat.ExpatError:
    title = 'No title'
    author = ''
    categories = ''
    print 'MALFORMED:', path
  

  Song(title=c.fix_encoding(title), path=path, author=c.fix_encoding(author), 