mirror of https://github.com/tilde-team/botany
run 2to3
This commit is contained in:
parent
595a4d7e31
commit
acb32ffca2
12
botany.py
12
botany.py
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
|
||||||
from __future__ import division
|
|
||||||
import time
|
import time
|
||||||
import pickle
|
import pickle
|
||||||
import json
|
import json
|
||||||
|
@ -249,7 +249,7 @@ class Plant(object):
|
||||||
else:
|
else:
|
||||||
with open(visitor_filepath, mode='w') as f:
|
with open(visitor_filepath, mode='w') as f:
|
||||||
json.dump([], f)
|
json.dump([], f)
|
||||||
os.chmod(visitor_filepath, 0666)
|
os.chmod(visitor_filepath, 0o666)
|
||||||
if not guest_timestamps:
|
if not guest_timestamps:
|
||||||
return self.watered_timestamp
|
return self.watered_timestamp
|
||||||
all_timestamps = [self.watered_timestamp] + guest_timestamps
|
all_timestamps = [self.watered_timestamp] + guest_timestamps
|
||||||
|
@ -473,7 +473,7 @@ class DataManager(object):
|
||||||
sqlite_dir_path = os.path.join(self.game_dir,'sqlite')
|
sqlite_dir_path = os.path.join(self.game_dir,'sqlite')
|
||||||
if not os.path.exists(sqlite_dir_path):
|
if not os.path.exists(sqlite_dir_path):
|
||||||
os.makedirs(sqlite_dir_path)
|
os.makedirs(sqlite_dir_path)
|
||||||
os.chmod(sqlite_dir_path, 0777)
|
os.chmod(sqlite_dir_path, 0o777)
|
||||||
conn = sqlite3.connect(self.garden_db_path)
|
conn = sqlite3.connect(self.garden_db_path)
|
||||||
init_table_string = """CREATE TABLE IF NOT EXISTS garden (
|
init_table_string = """CREATE TABLE IF NOT EXISTS garden (
|
||||||
plant_id tinytext PRIMARY KEY,
|
plant_id tinytext PRIMARY KEY,
|
||||||
|
@ -490,9 +490,9 @@ class DataManager(object):
|
||||||
|
|
||||||
# init only, creates and sets permissions for garden db and json
|
# init only, creates and sets permissions for garden db and json
|
||||||
if os.stat(self.garden_db_path).st_uid == os.getuid():
|
if os.stat(self.garden_db_path).st_uid == os.getuid():
|
||||||
os.chmod(self.garden_db_path, 0666)
|
os.chmod(self.garden_db_path, 0o666)
|
||||||
open(self.garden_json_path, 'a').close()
|
open(self.garden_json_path, 'a').close()
|
||||||
os.chmod(self.garden_json_path, 0666)
|
os.chmod(self.garden_json_path, 0o666)
|
||||||
|
|
||||||
def migrate_database(self):
|
def migrate_database(self):
|
||||||
conn = sqlite3.connect(self.garden_db_path)
|
conn = sqlite3.connect(self.garden_db_path)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
|
||||||
|
@ -6,6 +8,7 @@ garden_db_path = os.path.join(game_dir, 'sqlite/garden_db.sqlite')
|
||||||
conn = sqlite3.connect(garden_db_path)
|
conn = sqlite3.connect(garden_db_path)
|
||||||
c = conn.cursor()
|
c = conn.cursor()
|
||||||
c.execute("DELETE FROM visitors")
|
c.execute("DELETE FROM visitors")
|
||||||
print "Cleared weekly users"
|
print("Cleared weekly users")
|
||||||
conn.commit()
|
conn.commit()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ def update_garden_db():
|
||||||
# )
|
# )
|
||||||
# """.format(pid = "asdfasdf", pown = "jake", pdes = "big cool plant", page="25d", psco = str(25), pdead = str(False))
|
# """.format(pid = "asdfasdf", pown = "jake", pdes = "big cool plant", page="25d", psco = str(25), pdead = str(False))
|
||||||
|
|
||||||
print c.execute(update_query)
|
print(c.execute(update_query))
|
||||||
conn.commit()
|
conn.commit()
|
||||||
conn.close()
|
conn.close()
|
||||||
#print "bigggg booom"
|
#print "bigggg booom"
|
||||||
|
@ -68,7 +68,7 @@ def retrieve_garden_from_db(garden_db_path):
|
||||||
#init_database()
|
#init_database()
|
||||||
#update_garden_db()
|
#update_garden_db()
|
||||||
results = retrieve_garden_from_db(garden_db_path)
|
results = retrieve_garden_from_db(garden_db_path)
|
||||||
print results
|
print(results)
|
||||||
|
|
||||||
|
|
||||||
# con = sqlite3.connect(garden_db_path) #
|
# con = sqlite3.connect(garden_db_path) #
|
||||||
|
|
Loading…
Reference in New Issue