Forum OpenACS Q&A: Ybos Content Managemnet errors

Collapse
Posted by Dave Bauer on
After fiddling around with the content management system I am having at least one problem. This is a clean install of OpenACS 3.2.4 from the CVS. I am using a newly compiled AOLserver 3.2 with pgdriver 1.1. First, I had to compile the OpenACS version of the PG driver. I think I had an old version. Anyway, I have setup 2 content sections, and uploaded 1 file. Now I am trying to schedule it for the front page. When going from file- schedule-2.tcl to file-schedule-3.tcl I get the following error:
[02/Nov/2000:21:53:58][5429.9221][-conn5-] Error: Ns_PgExec: result 
status: 7 message: ERROR:  record new has no field 
lob                                     
                                                                      
          
[02/Nov/2000:21:53:58][5429.9221][-conn5-] Error: Database 
operation "dml" 
failed                                                                
              
Database operation "dml" 
failed                                                 
    while 
executing                                                             
"ns_db dml $db 
$sql"                                                            
    (file "/web/devel/www/admin/cm/file-schedule-3.tcl" line 
18)                
    invoked from 
within                                                         
"source 
$script"                                                              
  
    (procedure "ns_sourceproc" line 
6)                                          
    invoked from 
within                                                         
"ns_sourceproc cns29 {}"   
Another thing, it seems to pass the entire text of trim_content in the URL check it out:

http://devel.deepskydesign.com/admin/cm/file-schedule-2.tcl? file_id=2&file_title=Now+What% 3F&ColValue.livedate.month=November&ColValue.livedate.day=2&ColValue.l ivedate.year=2000&trim_content=%3Ch1%3ENow+What%3F%3C%2Fh1%3E%0D%0A% 3Ch3%3EGuide+to+Customizing+ACS+and+OpenACS%3C%2Fh3%3E%0D%0A%3Cp% 3Eby+Dave+Bauer+10%2F12%2F2000+dave@thedesignexperience.org%0D%0A%3C% 2Fp%3E%0D%0A%3C%2Fcenter%3E%0D%0A%3Cblockquote%3E%0D%0A%3Cp%3E%0D% 0AThe+advice+in+this+article+applies+to+OpenACS+3.2.4+and+probably+ACS +3.2.x.+If+you+have+any+corrections+or+additions+you+can+email+them+to +me+at+%3Ca+href%3D%22mailto%3Adave@thedesignexperience.org%22% 3Edave@thedesignexperience.org%3C%2Fa%3E.%3C%2Fp%3E%0D%0A%3Ch2% 3EGetting+Started%3C%2Fh2%3E%0D%0A%3Cp% 3EThis+document+assumes+that+you+have+installed+AOLserver% 2C+PostgreSQL+or+Oracle%2C+and+ACS+or+OpenACS% 2C+have+logged+in+as+the+default+administrator% 2C+changed+the+default+password% 2C+added+yourself+as+a+user+and+sitewide+administrator.+If+you+forgot+ to+change+the+default+password+do+it+now.+Now+you+are+ready+to+make+yo ur+site+do+something.+I+am+sorry+to+say+that+planning+is+in+order.+You +need+to+decide+what+you+site+will+be+and+what+it+will+do+before+you+b egin+coding.+Or+you+can+just+wing+it.+The+first+things+you+should+do+a re+read+all+the+documentation+you+can+find+including+these%3A%0D%0A

I think that this is too long for IE to process, anyway I don't think the variables should be sent in this way. I tried changing the amount of text that is in trim_content, but it didn't seem to matter. Thanks for any assistance!
Collapse
Posted by Dave Bauer on
I am also getting this error when I try to upload a new version of a file through document-upload-2.tcl.
[02/Nov/2000:22:04:36]
    Error: couldn't compile regular expression pattern: brackets [] not balanced
    couldn't compile regular expression pattern: brackets [] not balanced
        while executing
    "regexp {([^//]+)$} $upload_file match client_filename"
        invoked from within
    "if ![regexp {([^//]+)$} $upload_file match client_filename] {
        # couldn't find a match
        set client_filename $upload_file
    }"
        (file "/web/devel/www/cm/document-upload-2.tcl" line 60)
        invoked from within
    "source $script"
        (procedure "ns_sourceproc" line 6)
        invoked from within
    "ns_sourceproc cns61 {}"
Here is the code that I believe is causing the error:
# strip off the C:directories... crud and just get the file name               
if ![regexp {([^/]+)$} $upload_file match client_filename] {
     # couldn't find a match
     set client_filename $upload_file
}                                                                               
document-upload-new-2.tcl has the exact same regexp and it works fine. I can upload a new file, but not a new version of an existing file. Here is the regexp in document-upload-new-2.tcl
# strip off the C:directories... crud and just get the file name               
if ![regexp {([^/]+)$} $upload_file match client_filename] {
     # couldn't find a match
     set client_filename $upload_file
}
I really don't have the hang of regular expressions yet. Thanks!
Collapse
Posted by Dave Bauer on
OK. If you are using NSD8x with TCL 8.3.2 ( i think ) you cannot end a regular expression with . So i switched the / and  and now it works. What confuses my is why it didn't cause a problem in the document-upload-new-file-2.tcl.

Is Ybos or Furfly using nsd76 instead of nsd8x? I am curious to see if this really is the answer.

Collapse
Posted by Janine Ohmer on
We didn't really use the file scheduling feature so didn't work with
it much, but I just tried it on our site which uses this module and
it worked (or at least produced no errors, since I don't have a
"front page" for it to actually show up on).

This site is based on OpenACS 3.2.2, and is running AOLserver
3.1+ad9, using nsd8x.  The major difference is the OpenACS
version and I expect  that's where the trouble lies, though that's
only a guess.

I agree that passing that much content in the URL is A Bad
Thing, but our goal with the port was to make only porting-related
changes.

I'll see if Paul has time to install this with OpenACS 3.2.4 and
post here if he has to make any changes to get it to work.

Collapse
Posted by Dave Bauer on
Thanks.

I will see if I have a copy of OpenACS 3.2.2 around to test it with also. I don't need this for any projects, I was just fooling around with it. It would be nice to get it working with 3.2.4 so I will try to figure it out here also. It is good to know what system it has been tested and working with.

Collapse
Posted by Paul Doerwald on

I don't actually have a computer with the OpenACS available (been working with Oracle mostly), so I can't test anything that you're pointing to.

Anyway, standard line applies: It Worked For Me. A few things of note that are jumping out at me:

  • You're using the /cm/*.tcl code to add files. Try using the /admin/cm/*.tcl code instead. I worked a lot more on that code. For Furfly's production purposes, I actually deleted the /cm/* tree. If you use the admin stuff as your benchmark for what works, you'll probably have more luck. Anything that's causing an error in the user stuff can probably be replaced verbatim by code in the admin section.
  • The regexp's you cited are different. One said: regexp {([^//]+)$} $upload... and the other said: regexp {([^/]+)$} $upload... Note there's a backslash instead of a slash in the second one. Again, look to the admin version to see what's actually right. Using the admin code, I was able to upload many files and different versions without problem.
  • The problem you had with the Ns_PgExec error on the file-schedule-3.tcl code doesn't make much sense. Janine didn't say which version of the pgdriver Furfly was using, so perhaps the problem is there. (Doubtful). It's likely my bug, actually, because I never spent much time on file-schedule. Once I got it to work, I laid it to rest, because like Janine said, we didn't need it.

    I suspect, by looking at the error (and not having the code in front of me) that the cm.sql file didn't execute properly, and you're missing the column called lob. describe the relevant table, and check that it conforms with what's described in cm.sql.

See if any of these suggestions help. Hopefully they will. If they don't, hopefully by then I'll have my computer back from the brink again :).

Collapse
Posted by Dave Bauer on
Paul,

I have tracked down both errors. Thanks for pointing me in the right direction.

On the regexp, it is different in /cm/doucment-upload-2.tcl and /admin/cm/document-upload-2.tcl. I changed it to match the working one and everythign is fine.

This error:

[02/Nov/2000:21:53:58][5429.9221][-conn5-] Error: Ns_PgExec: result
status: 7 message: ERROR:  record new has no field
lob

is caused because the cm_front_page_rotate_schedule table has a trigger to execute procedure on_lob_ref()
which is not necessary because there is no lob field in that table. An lztext field is used to hold the front page scheduled content. I dropped the trigger and it was fixed.

Thanks for all your assistance, Now that it seems to be working, I will try upgrading my personal OpenACS site and see what happens. Luckily there is nothing valuable in there so I can experiment.

Do you know if the OpenACS site running this has the ad_user_content_map filter turned on? When I use cm_return_file for an HTML file, the ad_user_content_map proc dies because it is trying to grab a db handle when one is already in use. It looks like this filter is running before cm_file_return finishes and releases the db handle. Again, I really don;t need this either way, I am just curious to see if its only me!

Using all this information I am gathering from my trials, I will hopefully write up a little article on how to get it working with OpenACS 3.2.4, it does seem to work fine, but I will be testing more. I am already writing and article about customizing ACS and OpenACS so this fits in perfectly.

Collapse
Posted by Janine Ohmer on
Do you know if the OpenACS site running this has the ad_user_content_map filter turned on?

Yes, we do seem to have that filter turned on (I'm basing this on empirical evidence, since I can see in the log that the ad-user-content-map.tcl script is being sourced and filters are being activated).

When I use cm_return_file for an HTML file, the ad_user_content_map proc dies because it is trying to grab a db handle when one is already in use. It looks like this filter is running before cm_file_return finishes and releases the db handle. Again, I really don;t need this either way, I am just curious to see if its only me!

It's not just you (at least, I don't think so). I never use cm_return_file, so if there was a problem with it I wouldn't have seen it. In fact, I didn't know it existed until I just went and looked for it!

See, I started using the Ybos code right when it was first released, when there was no documentation yet. So I learned my own way of doing things, and since it works for me, I haven't needed to change. The content on Liz Krueger's site is all served out of templates, and the templates are sourced by cm_serve_section, which is in tcl/cm-defs.tcl. I can say with some confidence that this approach works well. :)

Obviously we could have done more testing of the parts we don't use - sorry you are running into all these problems. If you send me diffs of your fixes, I will include them and re-release the tarball.

Collapse
Posted by Peter Vessenes on
Just checking in here,

That cm_return_file bug has been hounding us for some time, thanks for the info.

We knew about the regexp bugs, we just hadn't release a patch, sorry for the frustration. (in this case, sorry to Paul, since you're all using his port.)

Just a side note to you acs 3.4/4.0 types; our most recent upgrade of the cm module moves away from passing the $selection variable to the index ADP, since we no longer get selection variables with the new database API. We've rewritten cm_serve_section to place everything in a list of ns_sets, and then pass the list. This works really well, and scares me less.

We're currently porting the cm module to 4.0, but if there's interest, we'll happily put up the code in the interim.

Collapse
Posted by Elizabeth Wirth on
We fixed the cm_return_file bug. It was crashing the system because if it was executed too many times in a row, db_write_blob would try to grab too many database handles. So instead of using db_write_blob (or one of its pre-3.4 variants) to write out $version_content, we used instead:

db_0or1row get_version_content "select version_content
from cm_versions
where version_id=$version_id"
ns_write $version_content

This solved the problem.