Forum OpenACS Q&A: backport of ad_page_contract for OpenACS 3.2.4

I munged the ACS 4.2 ad_page_contract to work for OpenACS 3.2.4.
I needed this right away because I am starting to teach a class next
week for which I wanted to use this and the new db API.
<p>
If anyone really wants a copy, I can send you the patch. I recommend
waiting until the OpenACS 4 port is released though.
Collapse
Posted by Don Baccus on
Hmmm...maybe Roberto can squeeze this in as an optional patch to the
3.2.5 release...

It's up to him, though.

Regardless, thanks for doing this and posting the URL, Henry.

We should probably release this as an optional patch, since we already froze the distribution.

I better go check the SDM for bug reports from 3.2.5 testers (you _are_ testing it rigth ? :)).

To check out the latest release for testing would I do

cvs -z3 -d:pserver:mailto:anonymous@cvs.acs-pg.sourceforge.net:/cvsroot/acs-pg co acs3-pg
?

Thanks,
Henry

Yes Henry. That's the right command to fetch the latest OpenACS from CVS.
Collapse
Posted by hafeez bana on
The "encoding system shiftjis" command in 00-ad-preload.tcl in Henry's patch causes it to fall over. Commenting this out makes everything work smoothly.
Collapse
8: Some more modifications (response to 1)
Posted by hafeez bana on
G'Day

There were more problems after my previous posting which have resulted me in making changes to some core openACS files(ad-abstract-url.tcl and ad-utilities.tcl).

I have put togther a tgz file at http://www.whyzero.com/~exalter/ which works out of the box for openACS 3.2.4

Have a look at the README file for more details. With the patches to ad-abstract-url.tcl, errors in tcl files now get displayed to the browser as opposed to getting a "Server Encountered Error" message and then having to look at the log (the error is echoed to log as well if that's what rocks your boat).

Hafeez, Henry, I am ready to add the ad_page_contract backport to a contrib section of OpenACS. Hafeez, have you tested your patched version of Henry's patches to see if the modifications in ad-abstract-url and ad-utilities.tcl.preload didn't break other modules?

Do the modifications to ad-abstract-url make it so that _every_ error is output to the browser? What if you don't want that to happen (e.g. you want to give your user a nice error page. AOLserver allows you to do that with plain ad-abstract-url AFAIK).

Sorry about asking this, but I am out of time to go look the answers for myself. Thanks.

G'day Rob,

I just ran a quick check after your post. My apologies for not doing this earlier. Things are broken. Note : All the tests below are with openacs 3.2.4.

Hafeez, Henry, I am ready to add the ad_page_contract backport to a contrib section of OpenACS. Hafeez, have you tested your patched version of Henry's patches to see if the modifications in ad-abstract-url and ad-utilities.tcl.preload didn't break other modules?
My changes to ad-utilities.tcl.preload - Commented out ad_proc in preference for ad_proc declared in Henri's 00-ad-proc.tcl. The new ad_proc handles -public etc switches

I did a grep of all files calling ad_proc. The one I found that is broken is "calendar/monthly.tcl" - The default arguments to calendar_basic_monthly called day_number_template has an escaped dollar sign. Escaping is not needed with the new ad_proc.

There are bugs with ad_proc in the way it passes arguments for example ad_text_to_html (in the main ACS 3.2.x distrib) that falls over when you pass in text with $ signs in them - but this is not in openACS 3.2.4

Otherwise I have tried to go through other files (haven't tried intranet as I haven't set it up) and have found no visible problems

Do the modifications to ad-abstract-url make it so that _every_ error is output to the browser? What if you don't want that to happen (e.g. you want to give your user a nice error page. AOLserver allows you to do that with plain ad-abstract-url AFAIK).
I don't understand what you mean exactly by every error. All I have done is to wrap the "source tcl_file_name" in a catch clause, check if the errorInfo is "ad_script_abort" in which case I exit cleanly, if not do an ns_write 200 with the errorInfo as well as write the error to log.

I could quickly add an option to disable this feature if you wanted. I think the main ACS distribution does this.

I have gone through quite a few pages that all use the ad_abstract_url and none have any issues. I have made a few dud pages with errors and they got echoed correctly to the browser.

ad_page_contract also works correctly with the above modifications

Sorry about asking this, but I am out of time to go look the answers for myself. Thanks.
No problems I should have checked this myself. But time is never on your side :)

Cheers, Hafeez

I've been bad about testing this -- I noticed the bug in the calendar
module / spam module, and even remembered that this happened with
ACS 4, but I didn't get around to fixing it. I will try to test
hafeez' patch in the next couple of days. Hafeez, is the latest copy
of your patch and fixes available for testing?

Thanks,

Henry

Hi Henry,

I have only modified the patches to recognize ErrorReporting2BrowserP in abstract-url section of the config file to enable (default) /disable the feature as robert mentioned. They are still available from the original location

Otherwise the issues with monthly.tcl still apply. I could include in the file a new ad-calendar-widget.tcl with the backslash removed?

Hafeez

I'm not quite sure what the best way to fix that calendar
quoting bug is in the patch because I am not sure how the patch
will be distributed. Is it going to be a "patch" file (i.e., a "diff -c") which is applied using the "patch" program? If the patch
is distributed that way, then it could automatically patch the code in
the calendar widget /tcl file.
I don't know what the "official OpenACS standard" for contrib material
is either, but my suggestion would be a 'diff -uNr' between the
original current release tree (3.2.5 as of now) and the tree with the
contributed material applied.

This also makes rolling contrib material into the distributiion at a
later time straightforward.

So, FWIW, my recommendation would be that the ad_page_contract
contribution would be in the form of a single .patch file created
by 'diff-uNr', which includes patches so that the contributed material
does not (knowingly!) break any other part of OpenACS.

I made the ad_page_contract and japanese patches available as tarballs
with the tcl files patched already, under a dir called tcl. On the top
level it has a README, etc.

I did it that way because I thought many people would have trouble
dealing with diffs. Since you will own the contrib code, you can
decide how to distribute it.