8 config
= ConfigParser
.RawConfigParser()
9 config
.read('/etc/dylanstestserver.ini')
10 domain
= config
.get('database', 'domain')
11 user
= config
.get('database', 'user')
12 password
= config
.get('database', 'password').replace('"', '')
13 database
= config
.get('database', 'database')
14 cursor
= db
.connect(domain
, user
, password
, database
).cursor()
16 notes
= os
.listdir('projects')
18 sql
= "SELECT title FROM projects"
20 results
= cursor
.fetchall()
23 existing_titles
.append(row
[0])
26 title
= note
[:note
.index('.')]
27 f
= open(os
.path
.join('projects', note
))
28 if title
in existing_titles
: continue
30 cursor
.execute("INSERT INTO projects (title, text)\
31 VALUES (%s, %s)", (title
, text
))