aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorSam Ockman2012-07-12 21:48:55 -0400
committerSam Ockman2012-07-12 21:48:55 -0400
commitf93de74671feafbabeed50c80226d57388210d01 (patch)
treed36cd7bc24947dfe6423b2dbed215c3c52cd7d8e /wqflask
parent193b82c4ce4b28d6a84be7a7b13b731d7e585c56 (diff)
downloadgenenetwork2-f93de74671feafbabeed50c80226d57388210d01.tar.gz
Dictionary code now works
Diffstat (limited to 'wqflask')
-rwxr-xr-xwqflask/wqflask/dataSharing/SharingInfo.py31
-rw-r--r--wqflask/wqflask/templates/data_sharing.html6
2 files changed, 27 insertions, 10 deletions
diff --git a/wqflask/wqflask/dataSharing/SharingInfo.py b/wqflask/wqflask/dataSharing/SharingInfo.py
index 1d22d57c..4845b5c8 100755
--- a/wqflask/wqflask/dataSharing/SharingInfo.py
+++ b/wqflask/wqflask/dataSharing/SharingInfo.py
@@ -60,7 +60,7 @@ class SharingInfo(object):
About_Array_Platform, About_Data_Values_Processing,
Data_Source_Acknowledge, Progreso """
- InfoRecord = namedtuple('InfoRecord', field_names)
+ #InfoRecord = namedtuple('InfoRecord', field_names)
# We can use string interpolation here cause we own the string
sql = """select %s from InfoFiles where """ % (field_names)
@@ -75,14 +75,18 @@ class SharingInfo(object):
info = cursor.fetchone()
print("432 info:", info)
print("type(info):", type(info))
- info = InfoRecord._make(info)
-
- print("q888 info.Title:", info.Title)
+ #info = InfoRecord._make(info)
+ info = todict(field_names, info)
+ # We need to edit info so we convert it to a dict...
+ #info = info._asdict()
+ print("q888 info.Title:", info['Title'])
print("info type is:", type(info))
- new_about_cases = unicode(info.About_Cases, "utf-8")
- print("new_about_cases is:", new_about_cases)
- info.About_Cases = new_about_cases
+ #new_about_cases = unicode(info.About_Cases, "utf-8")
+ #print("new_about_cases is:", new_about_cases)
+
+
+ #info['About_Cases'] = unicode(info['About_Cases'], "utf-8")
# fetch datasets file list
try:
@@ -130,3 +134,16 @@ class SharingInfo(object):
print("333 keys:", pf(info))
return info, htmlfilelist
#return SharingBody.sharinginfo_body_string % (info[31], info[32], infoupdate, info[32], info[1], info[3], info[30], info[4], info[27], info[33], info[2], info[23], info[26], info[11], info[15], info[16], info[18], info[19], info[20], info[21], info[22], info[13], info[12], info[14], info[14], htmlfilelist, info[6], info[35], info[36], info[37], info[38], info[39], info[40], info[5], info[7], info[8], info[9], info[10], info[17], info[24])
+
+
+def todict(fields, values):
+ """Converts sql results into a user friendly dictionary"""
+ new_dict = {}
+ fields = fields.split(",")
+ for counter, field in enumerate(fields):
+ field = field.strip()
+ value = values[counter]
+ if isinstance(value, str):
+ value = unicode(value, "utf-8")
+ new_dict[field] = value
+ return new_dict
diff --git a/wqflask/wqflask/templates/data_sharing.html b/wqflask/wqflask/templates/data_sharing.html
index a6e044b4..4e92106a 100644
--- a/wqflask/wqflask/templates/data_sharing.html
+++ b/wqflask/wqflask/templates/data_sharing.html
@@ -56,11 +56,11 @@
<p>
<table width="100%" border="0" cellpadding="5" cellspacing="0">
<tr><td><span style="font-size:115%;font-weight:bold;">Summary:</span></td></tr>
- <tr><td>{{ info.Summary }}<br><br></td></tr>
+ <tr><td>{{ info.Summary | safe}}<br><br></td></tr>
<tr><td><span style="font-size:115%;font-weight:bold;">About the cases used to generate this set of data:</span></td></tr>
- <tr><td> {{ info.About_Cases | safe}}</td></tr>
+ <tr><td>{{ info.About_Cases | safe}}</td></tr>
<tr><td><span style="font-size:115%;font-weight:bold;">About the tissue used to generate this set of data:</span></td></tr>
- <tr><td> {{ info.About_Tissue }}</td></tr>
+ <tr><td>{{ info.About_Tissue | safe }}</td></tr>
<tr><td><span style="font-size:115%;font-weight:bold;">About downloading this data set:</span></td></tr>
<tr><td> <P>All data links (right-most column above) will be made active as sooon as the global analysis of these data by the Consortium has been accepted for publication. Please see text on <A HREF="http://www.genenetwork.org/dataSharing.html" target="_empty" class="normalsize">Data Sharing Policies</A>, and <A HREF="http://www.genenetwork.org/conditionsofUse.html" target="_empty" class="normalsize">Conditions and Limitations</A>, and <A HREF="http://www.genenetwork.org/statusandContact.html" target="_empty" class="normalsize">Contacts</A>. Following publication, download a summary text file or Excel file of the PDNN probe set data. Contact RW Williams regarding data access problems.
</P><br><br></td></tr>