[Zope] Content Management
Don Brooksby
DonB@clh.com
Wed, 12 Feb 2003 13:14:53 -0700
Greetings Zope Mentors...
I am of a grave realization that perhaps I am once again banging my head =
on a brick wall.
I am the one, some may remember, that is using PostgreSQL for data =
collection and writing dtml forms for administration of articles that =
can be pulled from one data source for multiple locations in my website. =
My last problem was in reference of pulling a checkbox value into a =
dtml page.
Now, with all of that working, my problem is writing back to the table =
with the updated information on an article. Below is my list of trial =
and errors:
* I have verified that up to the dtml method of collecting the proper =
information.
* I have tried, in my dtml method of posting to the database, all =
different ways of collecting the data to be written.
(this is where my data fails to post to the tables)
Because in my reading of other emails that are posting to Zope, as much =
info as possible is what is requested, so here are 2 dtml methods where =
I am seeing the failures - no error pages are displayed, it just tells =
me it was not successful writing.
1st method, where all changed information to the article is gathered.
Data checks are preformed before the following code - seeing if the =
checkbox is set to 1 or 0...
<<DTML Method -updateArticle_html>>
<!-- START OF WRITING INFO TO TABLE IN POSTGRESQL -->
<dtml-try>
<dtml-call "article1_updateRecord(
a1_Title=3D_['newtitle'],=20
a1_Author=3D_['newauthor'],
a1_Body=3D_['newbody'],
a1_Pix1=3D_['newpix1'],
a1_Pix2=3D_['newpix2'],
a1_Date=3D_['newdate'],
ai1=3D_['newmain'],
ai2=3D_['newstate'],
ai3=3D_['newmesc'],
ai4=3D_['newcorp'],
ai5=3D_['newgsa'],
ai6=3D_['newreseller'],
ai8=3D_['newnetapp'],
ai9=3D_['newmobile'],
ai10=3D_['neweducation'],
a1_Publish=3D_['newpublish'],
a1_IDNum=3D_['newarticle'])">
<dtml-call "REQUEST.set('status', 'ok')">
<dtml-except>
<dtml-call "REQUEST.set('status', 'failed')">
</dtml-try>
<dtml-if "_['status']=3D=3D'ok'">
<h1>Record was sucessfully Updated.</h1>
<form action=3D"index_html">
<input type=3D"submit" value=3D"OK">
</form>
<dtml-else>
<h1>Updating the new record failed.<br>No record was changed.</h1>
<table>
<tr>
<td>
<form action=3D"update_article_html">
<input type=3D"submit" value=3D"Try Again">
</form>
</td>
<td>
<form action=3D"index_html">
<input type=3D"submit" value=3D"OK">
</form>
</td>
</tr>
</table>
</dtml-if>
--------------------------
The *dtml-call "article1_updateRecord* calls the following ZSql method:
<<Arguments:>>
A1_Title A1_Author A1_Body A1_Pix1 A1_Pix2 A1_Date Ai1 Ai2 Ai3 Ai4 Ai5 =
Ai6 Ai8 Ai9 Ai10 A1_Publish A1_IDNum
<<SQL statement:>>
UPDATE A1
SET=20
A1_Title=3D<dtml-sqlvar a1_Title type=3D"string">,
A1_Author=3D<dtml-sqlvar a1_Author type=3D"string">,
A1_Body=3D<dtml-sqlvar a1_Body type=3D"string">,
A1_Pix1=3D<dtml-sqlvar a1_Pix1 type=3D"string">,
A1_Pix2=3D<dtml-sqlvar a1_Pix2 type=3D"string">,
A1_Date=3D<dtml-sqlvar a1_Date type=3D"string">,
Ai1=3D<dtml-sqlvar ai1 type=3D"string">,
Ai2=3D<dtml-sqlvar ai2 type=3D"string">,
Ai3=3D<dtml-sqlvar ai3 type=3D"string">,
Ai4=3D<dtml-sqlvar ai4 type=3D"string">,
Ai5=3D<dtml-sqlvar ai5 type=3D"string">,
Ai6=3D<dtml-sqlvar ai6 type=3D"string">,
Ai8=3D<dtml-sqlvar ai8 type=3D"string">,
Ai9=3D<dtml-sqlvar ai9 type=3D"string">,
Ai10=3D<dtml-sqlvar ai10 type=3D"string">,
A1_Publish=3D<dtml-sqlvar a1_Publish type=3D"string">
WHERE
A1_IDNum=3D<dtml-sqlvar a1_IDNum type=3D"string">
-------------------------
** all items in the table are set to "string" - so I am writing Strings =
to the db.
I have tested this method with '<dtml...>' and all other ways that are =
suggested by all the different documentation I have read about zope. =
This is the only way I have been able to write data to the db table when =
adding, so slight modification for Updates seem rational.
*sigh* where am I getting this wrong? Does anyone have ideas?
Don Brooksby