Skip to content
This repository has been archived by the owner on Mar 3, 2018. It is now read-only.

Sql #119

Open
wants to merge 12 commits into
base: wikilinked
Choose a base branch
from
Open

Sql #119

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
isenv/
data/
*.pyc
*.egg-info
10 changes: 0 additions & 10 deletions map_of_innovation.egg-info/PKG-INFO

This file was deleted.

152 changes: 0 additions & 152 deletions map_of_innovation.egg-info/SOURCES.txt

This file was deleted.

1 change: 0 additions & 1 deletion map_of_innovation.egg-info/dependency_links.txt

This file was deleted.

7 changes: 0 additions & 7 deletions map_of_innovation.egg-info/entry_points.txt

This file was deleted.

1 change: 0 additions & 1 deletion map_of_innovation.egg-info/not-zip-safe

This file was deleted.

2 changes: 0 additions & 2 deletions map_of_innovation.egg-info/paster_plugins.txt

This file was deleted.

1 change: 0 additions & 1 deletion map_of_innovation.egg-info/requires.txt

This file was deleted.

1 change: 0 additions & 1 deletion map_of_innovation.egg-info/top_level.txt

This file was deleted.

Binary file removed mapofinnovation/__init__.pyc
Binary file not shown.
Binary file removed mapofinnovation/config/__init__.pyc
Binary file not shown.
Binary file removed mapofinnovation/config/environment.pyc
Binary file not shown.
Binary file removed mapofinnovation/config/middleware.pyc
Binary file not shown.
Binary file removed mapofinnovation/config/routing.pyc
Binary file not shown.
24 changes: 14 additions & 10 deletions mapofinnovation/controllers/adminfunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,27 @@

class AdminfuncController(BaseController):

@jsonify
# @jsonify
def addfromcsv(self):
if os.environ.get("REDIS_URL") :
redis_url = os.environ.get("REDIS_URL")
else:
redis_url = "localhost"
r_server = redis.Redis(redis_url)
redis_url = "localhost"
r_server = redis.Redis(redis_url)
with open('mapofinnovation/public/updated_spaces_ready_for_merge.csv', 'rb') as csv_file:
dialect = csv.Sniffer().sniff(csv_file.read(), delimiters=',')
csv_file.seek(0)
csv_reader = csv.DictReader(csv_file, dialect=dialect)
for row in csv_reader:
tempkey = (str(row['name']+str(datetime.now())))
key = ''.join(e for e in tempkey if e.isalnum())
#TODO : shift this code to another function
row.update({'wiki':('/uifunc/wikipage/'+key)})
row.update({'archived':False})
row.update({'verified':True})
r_server.hmset(re.sub(' ','',key),row)
tempkey = (str(row['name']+str(datetime.now())))
key = ''.join(e for e in tempkey if e.isalnum())
#TODO : shift this code to another function
row.update({'wiki':('/uifunc/wikipage/'+key)})
row.update({'archived':False})
row.update({'verified':True})
r_server.hmset(re.sub(' ','',key),row)
return {'success':'true'}

if __name__ == "__main__":
instance = AdminfuncController()
AdminfuncController.addfromcsv(instance)
Loading