[Zope] Zope with Microsoft Access
Hi, this is my first posting to the list, and about my 4th day working with Zope. I have a bit of a problem. All my code so far is working well. Just the following section is defying my attempts to make it run. What it does is to update a field in the database (to allow employees to quickly update their hours in the hours tracking thing I'm creating) it's complex since all the employees hours will be listed on one page and will be instantly updatable (with a select box that allows the choice of +/- (name is modifydtml-var hoursID and value is either + hours already input or - hours already input) and a text field for entering hours to add or subtract (name is mod_hoursdtml-var hoursID)). The code (in the DTML document) is: dtml-in "REQUEST.form.items()" dtml-if "_.string.find(_['sequence-key'], 'mod_hours')" dtml-else dtml-let mykey=sequence-key myval=sequence-item dtml-in "REQUEST.form.items()" dtml-if "_.string.find(_['sequence-key'], 'modify')" dtml-else dtml-if "_['sequence-key'][6:9] == mykey[9:12]" dtml-if myval dtml-call UpdateHours(REQUEST) /dtml-if /dtml-if /dtml-if /dtml-in /dtml-let /dtml-if /dtml-in and the SQL method UpdateHours is: update emp_hours set hours = dtml-var expr="_['sequence-item']" dtml-var expr="_['myval']" where hoursID = dtml-var expr="_['mykey'][9:12]"; with arguments: sequence-item, myval, mykey I've tried everything I can think of but it not only refuses to do anything, it also refuses to raise an error. If anyone can help out I'd be very grateful. Thanks Mike Kelland [EMAIL PROTECTED] ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Zope with Microsoft Access
Hrm... I've tried what you said, but it still fails to work... Is there a Zope guru out there who is willing to look over this code in it entirety (ie the DTML and the ZSQL Method) and work with me directly to try to get this working? Thanks, Mike [EMAIL PROTECTED] - Original Message - From: "Chris Gray" [EMAIL PROTECTED] To: "Mike Kelland" [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, November 23, 2000 3:56 PM Subject: Re: [Zope] Zope with Microsoft Access Here's a fix. Change the line: dtml-call UpdateHours(REQUEST) to: dtml-call "UpdateHours(myval=_['myval'], mykey=_['mykey'], sequence_item=_['sequence-item'])" and change the name of the parameter in your ZSQL method from sequence-item to sequence_item and change the dtml-var tag in the method to dtml-var sequence_item. Cheers, Chris On Wed, 22 Nov 2000, Mike Kelland wrote: What does dtml-var "0/0" actually do? Looks like all it would do is divide by zero which *has* to be some kind of error. The problem, I think, lies mainly in the arguments being passed to UpdateHours. I have done a whole slew of tests to show that my if statement works perfectly (the _.string.find thing seems to return false if it finds the specified sub string which is odd, but works) and I've actually outputted the correct SQL in the DTML (ie displayed it within the page) and I've copied and pasted that SQL directly into a ZSQL Method and ran it on my database and that works fine. However it seems to do absolutly nothing when I actually attempt to run everything together and call UpdateHours from the DTML document. I've played a little with namespace as well, but as I said, I'm new to all this so there may be an error there. Thanks for everyone's insight so far, it's really helpful, and please keep those suggestions coming! : ) Mike Kelland [EMAIL PROTECTED] - Original Message - From: "[EMAIL PROTECTED]" [EMAIL PROTECTED] To: "Mike Kelland" [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, November 22, 2000 8:48 PM Subject: Re: [Zope] Zope with Microsoft Access You may not be entering UpdateHours. Try dtml-var "0/0" just before the call to UpdateHours. Or some other obvious way to know if your entering it. Here's how I coded the same kind of thing. Although I'm reading the Zope book right now to see how I should have done it. The book is good and I might just learn a better solution than 0/0 :) --- Part of addContact form action="insertNewContactForm" method="get" table trtdName:/tdtdinput type="text" name="name" /td/tr trtdTitle:/tdtdinput type="text" name="title"/td/tr trtdPhone:/tdtdinput type="text" name="phone"/td/tr /table tabletr tdinput type="submit" name="cmd" value="Insert"/td tdinput type="submit" name="cmd" value="Update"/td tdinput type="submit" name="cmd" value="Delete"/td tdinput type="submit" name="cmd" value="Clear"/td /tr/table /form ---insertNewContactForm dtml-if expr="_.len(name) 0" dtml-if expr="cmd=='Insert'" dtml-var insertNewContact dtml-elif expr="cmd=='Delete'" dtml-call deleteWhere dtml-elif expr="cmd=='Update'" dtml-call updateWhere dtml-elif expr="cmd=='Clear'" /dtml-if /dtml-if dtml-var "RESPONSE.redirect('addContact')" --Darrell ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Zope with Microsoft Access
I actually have this up and running now (as of about 5 minutes ago). It's a hack but it works great so I'm not going to mess with it. Thanks a lot to everyone who gave me pointers, most especially Chris Gray whose solution fixed it in the end. Now I need a way of implementing Apache style authentication. Is there an easy way to do this? Thanks! Mike [EMAIL PROTECTED] - Original Message - From: "Rik Hoekstra" [EMAIL PROTECTED] To: "Mike Kelland" [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, November 24, 2000 12:21 PM Subject: Re: [Zope] Zope with Microsoft Access Hi, this is my first posting to the list, and about my 4th day working with Zope. I have a bit of a problem. All my code so far is working well. Just the following section is defying my attempts to make it run. What it does is to update a field in the database (to allow employees to quickly update their hours in the hours tracking thing I'm creating) it's complex since all the employees hours will be listed on one page and will be instantly updatable (with a select box that allows the choice of +/- (name is modifydtml-var hoursID and value is either + hours already input or - hours already input) and a text field for entering hours to add or subtract (name is mod_hoursdtml-var hoursID)). The code (in the DTML document) is: dtml-in "REQUEST.form.items()" dtml-if "_.string.find(_['sequence-key'], 'mod_hours')" dtml-else dtml-let mykey=sequence-key myval=sequence-item dtml-in "REQUEST.form.items()" dtml-if "_.string.find(_['sequence-key'], 'modify')" dtml-else dtml-if "_['sequence-key'][6:9] == mykey[9:12]" dtml-if myval dtml-call UpdateHours(REQUEST) /dtml-if /dtml-if /dtml-if /dtml-in /dtml-let /dtml-if /dtml-in and the SQL method UpdateHours is: update emp_hours set hours = dtml-var expr="_['sequence-item']" dtml-var expr="_['myval']" where hoursID = dtml-var expr="_['mykey'][9:12]"; with arguments: sequence-item, myval, mykey I've tried everything I can think of but it not only refuses to do anything, it also refuses to raise an error. If anyone can help out I'd be very grateful. This seems to be more of a DTML problem than an Access problem. It is hard to follow anyway... A few questions: have you tried using something like changing the form names to using the name.item:records syntax. something like input type="checkbox" name="modify.dtml-var hoursID:records" value="+" input type="checkbox" name="modify.dtml-var hoursID:records" value="-" input type="hidden" name="modify.inputhrs:records" value="hours already input" and a text field for entering hours to add or input type= "text" name="modify.mod_hours:records" value="dtml-var hoursID" this will give your dtml method a dictionary like structure called modify you can loop over. Starting from there will save you a whole lot of hacking. Also I'm not at all sure that you can use the [sequenct-key] as arguments for your SQL Method. On the records and types in forms see: http://www.zope.org/Members/Zen/howto/FormVariableTypes hth Rik ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] SQL and dtml-tree
I'm attempting to create a tree structure using dtml-tree from SQL results but I'm finding the documentation exceedingly cryptic. What I want to do is create the following structure: Client1 (tree Branch) Project1 Edit | Delete Project2 Edit | Delete Client2 Project1 Edit | Delete Client3 Client4 out of a database contaning the above information (ie client names, project names, and unique identifiers for each). I have the SQL queries that will give me the appropriate information I just need how to make the dtml-tree tag work with this. Any help whatsoever would be useful, thanks! Mike [EMAIL PROTECTED]
[Zope] dtml-tree stuff
I think I may not have asked a specific enough question last time round. I'll try it again. I've been looking through the How-To's and the documentation and the dtml-tree stuff that I have found seems exceedingly cryptic. The closest that I've come to a solution is the following code: dtml-in "getAllClientNames(REQUEST)"dtml-tree id=clientID branches_expr="getClientsForProjects(get_clientID=clientID)" dtml-var company_name/dtml-tree/dtml-in where getAllClientNames looks like: select company_name,clientID from client; and getClientsForProjects looks like: select company_name, clientID from client where deleted = 0 and clientID = dtml-sqlvar get_clientID type=int; This gives me a tree structure which, when I expand company1 gives me company1 again and again (ie Company1 Company1 Company1 Company1 etc as deep as I care to go Company2 Company2 etc Company3 Company4 What I'm trying to do is list my company name as the tree branch and have the sub headings of each branch be my projects for that company. Can anyone help? Thanks very much Mike Kelland [EMAIL PROTECTED]
[Zope] string splitting in dtml
I have a date string (ie dd/mm/yy) which I'm drawing out of a database (ODBC connection to Access) with a Z SQL method and I need to use that data to set the initial condition of a set of 3 select items (ie day, month and year). Is there a way to split this date (it'll come out looking like dd/mm/yy) to get the components of it so that I can do: select name="start_month"dtml-in "1,2,3,4,5,6,7,8,9,10,11,12"dtml-if"some_split_of_date_string_to_get_month(start_date)== _['sequence-item']"option value="dtml-var sequence-item" selecteddtml-var sequence-item/optiondtml-elseoption value="dtml-var sequence-item"dtml-var sequence-item/option/dtml-if/dtml-in/select ?? Thanks! Mike Kelland [EMAIL PROTECTED]
Re: [Zope] string splitting in dtml
I tried what you recommended and got the following error: Error Type: AttributeError Error Value: __getslice__ The problem I think is that the variable is drawn from the database as type date (Microsoft Access 2k) and somehow is cast into a date type. Is there a way to re-cast this variable as a string type? Or is there another reason it's not working (I've tried it with my other varibles pulled from the database in the same query and it's only the date types that are giving this error, all other variables work fine)? I also tried the dtml-var "_.string.split(start_date, '/')[1]" solution but got the error: Error Type: TypeError Error Value: argument 1: expected read-only character buffer, instance found Thanks very much for everyone's help so far! Mike Kelland [EMAIL PROTECTED] - Original Message - From: "Spicklemire, Jerry" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, December 04, 2000 4:38 PM Subject: [Zope] string splitting in dtml Mike asked: I have a date string (ie dd/mm/yy) which I'm drawing out of a database (ODBC connection to Access) with a Z SQL method and I need to use that data to set the initial condition of a set of 3 select items (ie day, month and year). Is there a way to split this date (it'll come out looking like dd/mm/yy) to get the components of it You could use the Python "string slice" syntax, like so: dtml-let day_of_month="_['start_date'][:2]" month_of_year="_['start_date'][3:5]" year_of_century="_['start_date'][6:8]" The dtml-var day_of_month day,br of the dtml-var month_of_year month,br of the year 20dtml-var month_of_centurybr /dtml-let Later, Jerry S. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Adding users
Is it possible to have a form in a zope page that allows you to add a new user to the acl_users folder? I can get the data I need, I just need to know, if I have the user name and password as dtml variables, and the user adding the other user has all the appropriate permissions, is there a way in dtml to use this information to add a user (with a defined role). Thanks very much for this and prior help! Mike Kelland [EMAIL PROTECTED]
[Zope] Adding users to acl_users
Hi everyone, I tried to add the manage_users thing that someone referred me to (sorry that I don't remember who) and got the following error: Error Type: KeyErrorError Value: __cmp__ my code is as follows: table width="600" border="0" cellpadding="3" cellspacing="1"tr class="one"td style="text-align:left" colspan="2"User Name: brinput name="name"/td/tr tr class="two"td style="text-align:left"Password:brinput name="password"/tdtd style="text-align:left"Confirm Password: brinput name="confirm"/td/tr tr class="one" td style="text-align:left" colspan="2"Role: brSELECT NAME="roles:list" SIZE="5" MULTIPLE OPTION VALUE="Manager"Manager OPTION VALUE="Owner"Owner OPTION VALUE="User"User/SELECTbrINPUT TYPE="TEXT" NAME="domains:tokens" VALUE="" SIZE="40"/td/tr tr class="two"td colspan="2"input type="submit" name="submit" value="Add"/table -END- to get the information and I'm using the code: dtml-with acl_usersdtml-call expr="manage_users(REQUEST)"/dtml-with to process it. I've taken the code pretty much directly from the acl_users folder's Add form... Anyone know what's going on? Thanks again for everyone's help. The _.str(date) thing worked perfectly with my Access date problem... Mike Kelland [EMAIL PROTECTED]
[Zope] Adding Users To Acl_users
Is it possible to add users to acl users from a form other than that in the acl_users folder? I've tried replicating the form within a dtml-with acl_users tag with no luck so far, has anyone actually done this and made it work? Thanks! Mike Kelland [EMAIL PROTECTED]
Re: [Zope] Adding Users To Acl_users
Perfect, thank you so much! Mike Kelland - slowly getting the hang of this whole Zope thing... [EMAIL PROTECTED] - Original Message - From: "Steve Drees" [EMAIL PROTECTED] To: "Mike Kelland" [EMAIL PROTECTED] Cc: "Zope@Zope. Org" [EMAIL PROTECTED] Sent: Thursday, December 14, 2000 11:35 AM Subject: RE: [Zope] Adding Users To Acl_users Is it possible to add users to acl users from a form other than that in the acl_users folder? I've tried replicating the form within a dtml-with acl_users tag with no luck so far, has anyone actually done this and made it work? dtml-call "REQUEST.set('name','bill')" dtml-call "REQUEST.set('password','mypassword')" dtml-call "REQUEST.set('confirm','mypassword')" dtml-call "REQUEST.set('roles',['RegisteredUser'])" dtml-call "acl_users.manage_users('Add',REQUEST,RESPONSE)" Creates a user bill with password mypassword and role of RegisteredUser ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Perl Scripting in Zope
I'm running Zope on a Windoze 2k machine (no, I'm not happy about the situation ;P ) and I'm a Perl programmer by training. Has Perl Scripting support been ported to Win yet and if so could someone possibly run me through the procedure of installing it (I'm a bit of a newb to installing ports in Win32)? Thanks very much! Mike Kelland [EMAIL PROTECTED]