# Path: webapp/model.py
# class Song(SQLObject):
# #  _connection = hub
# 
#   # doesn't have to be alt ID ... but perhaps we don't want dupes? (ALSO used
#   # as alt ID for index method)
#   # I changed it to False, b/c it causes problems with importing
#   path = StringCol(alternateID=True)
#   title = StringCol(alternateID=False)
#   author = StringCol(alternateID=False)
#   categories = StringCol(alternateID=False)
#   content = StringCol(alternateID=False)
#   copyright = StringCol(alternateID=False)
# 
# class Songbook(SQLObject):
# #  _connection = hub
# 
#   path = StringCol(alternateID=True)
#   title = StringCol(alternateID=False)
# 
# class User(SQLObject):
#     """Reasonably basic User definition.
# 
#     Probably would want additional attributes.
# 
#     """
#     # names like "Group", "Order" and "User" are reserved words in SQL
#     # so we set the name to something safe for SQL
#     class sqlmeta:
#         table = 'tg_user'
# 
#     user_name = UnicodeCol(length=16, alternateID=True,
#                            alternateMethodName='by_user_name')
#     email_address = UnicodeCol(length=255, alternateID=True,
#                                alternateMethodName='by_email_address')
#     display_name = UnicodeCol(length=255)
#     password = UnicodeCol(length=40)
#     created = DateTimeCol(default=datetime.now)
# 
#     # groups this user belongs to
#     groups = RelatedJoin('Group', intermediateTable='user_group',
#                          joinColumn='user_id', otherColumn='group_id')
# 
#     def _get_permissions(self):
#         perms = set()
#         for g in self.groups:
#             perms |= set(g.permissions)
#         return perms
# 
#     def _set_password(self, cleartext_password):
#         """Run cleartext_password through the hash algorithm before saving."""
#         password_hash = identity.encrypt_password(cleartext_password)
#         self._SO_set_password(password_hash)
# 
#     def set_password_raw(self, password):
#         """Saves the password as-is to the database."""
#         self._SO_set_password(password)
# 
# def bootstrap_model(clean=False, user=None):
#     """Create all database tables and fill them with default data.
# 
#     This function is run by the 'bootstrap' function from the commands module.
#     By default is calls two functions to create all database tables for your
#     model and optionally create a user.
# 
#     You can add more functions as you like to add more boostrap data to the
#     database or enhance the functions below.
# 
#     If 'clean' is True, all tables defined by you model will dropped before
#     creating them again. If 'user' is not None, 'create_user' will be called
#     with the given username.
# 
#     """
#     create_tables(clean)
#     if user:
#         create_default_user(user)


import os
import re
import cgi
import glob
import time
import shelve
import dumbdbm
import whichdb
import posixpath
import mono2song
import xml.sax.saxutils
import xml.parsers.expat
import webapp.c_utilities as c
  import xml.etree.cElementTree as ET
  import xml.etree.ElementTree as ET
from webapp.model import Song, Songbook, User, bootstrap_model
# -*- coding: utf-8 -*-
try: # try c version for speed then fall back to python
except ImportError:

ALL_SONGS_PATH = "songbooks/all.xml"

def initialize_db():

# Path: webapp/model.py
# class Song(SQLObject):
# #  _connection = hub
# 
#   # doesn't have to be alt ID ... but perhaps we don't want dupes? (ALSO used
#   # as alt ID for index method)
#   # I changed it to False, b/c it causes problems with importing
#   path = StringCol(alternateID=True)
#   title = StringCol(alternateID=False)
#   author = StringCol(alternateID=False)
#   categories = StringCol(alternateID=False)
#   content = StringCol(alternateID=False)
#   copyright = StringCol(alternateID=False)
# 
# class Songbook(SQLObject):
# #  _connection = hub
# 
#   path = StringCol(alternateID=True)
#   title = StringCol(alternateID=False)
# 
# class User(SQLObject):
#     """Reasonably basic User definition.
# 
#     Probably would want additional attributes.
# 
#     """
#     # names like "Group", "Order" and "User" are reserved words in SQL
#     # so we set the name to something safe for SQL
#     class sqlmeta:
#         table = 'tg_user'
# 
#     user_name = UnicodeCol(length=16, alternateID=True,
#                            alternateMethodName='by_user_name')
#     email_address = UnicodeCol(length=255, alternateID=True,
#                                alternateMethodName='by_email_address')
#     display_name = UnicodeCol(length=255)
#     password = UnicodeCol(length=40)
#     created = DateTimeCol(default=datetime.now)
# 
#     # groups this user belongs to
#     groups = RelatedJoin('Group', intermediateTable='user_group',
#                          joinColumn='user_id', otherColumn='group_id')
# 
#     def _get_permissions(self):
#         perms = set()
#         for g in self.groups:
#             perms |= set(g.permissions)
#         return perms
# 
#     def _set_password(self, cleartext_password):
#         """Run cleartext_password through the hash algorithm before saving."""
#         password_hash = identity.encrypt_password(cleartext_password)
#         self._SO_set_password(password_hash)
# 
#     def set_password_raw(self, password):
#         """Saves the password as-is to the database."""
#         self._SO_set_password(password)
# 
# def bootstrap_model(clean=False, user=None):
#     """Create all database tables and fill them with default data.
# 
#     This function is run by the 'bootstrap' function from the commands module.
#     By default is calls two functions to create all database tables for your
#     model and optionally create a user.
# 
#     You can add more functions as you like to add more boostrap data to the
#     database or enhance the functions below.
# 
#     If 'clean' is True, all tables defined by you model will dropped before
#     creating them again. If 'user' is not None, 'create_user' will be called
#     with the given username.
# 
#     """
#     create_tables(clean)
#     if user:
#         create_default_user(user)


# Path: db.py
import os
import re
import cgi
import glob
import time
import shelve
import dumbdbm
import whichdb
import posixpath
import mono2song
import xml.sax.saxutils
import xml.parsers.expat
import webapp.c_utilities as c
  import xml.etree.cElementTree as ET
  import xml.etree.ElementTree as ET
from webapp.model import Song, Songbook, User, bootstrap_model

# -*- coding: utf-8 -*-
try: # try c version for speed then fall back to python
except ImportError:

ALL_SONGS_PATH = "songbooks/all.xml"

def initialize_db():

  bootstrap_model()