Re: [Zope] SQL delimiter?
You need to insert the following line between two SQL statements. Remember you can't use it with more than one SELECT. sql_delimiter is usefull only to separate more than one INSERT, UPDATE, DELETE. José Andy McKay wrote: > Ive looked through the docs and Im sure I saw once (but cant see it now), > some sort of delimiter between SQL statements allowing me to put multiple > SQL statements in one SQLMethod. Was I imagining that? > -- > Andy McKay. > > ___ > 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] Error, Exceptions.SystemError: unknown opcode
Hi all, I'm trying to insert data into a MySQL table using a SQL Method without success. Zope return me the following message: "Error, Exceptions.SystemError: unknown opcode" Any ideas? Thanks José ___ 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] Last day of Month
Use an External Method like this one. # Perché non usare un metodo esterno? from DateTime import Date def lastDay(year,month): try: last = Date(year,month+1,1)-1 return last.day except: return 31 José Eric Walstad wrote: > Hi Paolo, > I have a Python Metho... er Python Script that I use that tells me the days > in each month. You pass in a Zope DateTime object as a parameter and it > returns the days in that month: > > Parameters: ZopeDateTime > Code: > -8<-- Start Snip --8<- > if ZopeDateTime.isLeapYear(): > intDaysInFebruary = 29 > else: > intDaysInFebruary = 28 > > strMonthName=ZopeDateTime.Month() > > dicDaysPerMonth = > {'January':31,'February':intDaysInFebruary,'March':31,'April':30,'May':31,'J > une':30,'July':31,'August':31,'September':30,'October':31,'November':30,'Dec > ember':31} > > return dicDaysPerMonth.get(strMonthName, 0) > -8<-- End Snip --8<- > > Hope that helps. > > Eric. > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Paolo > Quaglia > Sent: Tuesday, December 12, 2000 4:05 AM > To: [EMAIL PROTECTED] > Subject: [Zope] Last day of Month > > Hi everibody > Is there some tricky way to know the last day of the month of a DateTime > object? > for ex: if my DateTime object is 12/12/2000 is there a method or a > function that return the last day of the month? (in this example 31) > > Thanks a lot > Paolo Quaglia > Information Technology Coordinator > Sitek S.p.A. > [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 ) ___ 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] multiple selects are not allowed
from ZSQL Methods User's Guide, last row on pag. 22: "Note that no more than one SQL select statement may be used in a single SQL Database Method." Diny van Gool wrote: > Hi, > > I want to execute multiple SQL statements in one SQL-Method. In the > mailinglist archives i found the answer but when i try it i get an error: > > Error, exceptions.ValueError: multiple selects are not allowed > > I used a simple Z SQL Method query (Zope 2.2.2) just to try: > > select * > from GENEESM_DIER > > > > select * > from TOED_WIJZE > > What am i doing wrong? > > Diny > > DIVA, Faculty of Veterinary Medicine > Utrecht University, The Netherlands > http://www.vet.uu.nl > > ___ > 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] Patch to avoid hypenation variables and more
Tino Wildenhain wrote: > Hi, > > anybody had time for testing? May be we could have it in the next > zope release. Any comments, remarks? How about an alternatively or > extra "name"-attribute wich defaults to "sequence" ? > > Another issue: what about an alias for called something > like: or ? Just for the > ones that lern zope. Since I often see the missunderstood meaning > of in such constructs like: indexvar>]"> > you know what I mean? I think it would be more obvious, if the > tag would usually be called or something. > Yes. I vote for > > Regards > Tino > > Tino Wildenhain schrieb: > > > > Michel Pelletier schrieb: > > > > > > > > > The second problem is if you put one in-tag into another. > > > > You have to use oder REQUEST.set() with variables > > > > of the outher in-tag to be able to reference them in the inner > > > > loop. The code becomes very ugly this way. So my idea was to > > > > give the in-tag an optional argument, called "prefix" to > > > > prefix all the sequence-variables with a custom identifier. > > > > So you can write: > > > > > > > > > > > > > > > > : > > > > > > > > > > > > > > > > What do you think about this? > > > > > > It's cool. Your patches are big and therefore, naturally, are a bit > > > worrisome to us in terms of checking them into the core. Do you have a > > > set of test DTML scripts that verify your patch? Say, a set of scripts > > > that verifies backwards compatibity, and a set of scripts that verifies > > > the new functionality? I would suggest even investigating "ZUnit" and > > > creating DTML unit tests. Then we would *really* love you. ;) > > > > > Have to find this ZUnit... ;) > > Ok, I made some further tests and improvements. There was a mistake > > (ok, it comes from variables spilled randomly over DT_In.py and > > DT_InSV.py ;) > > with the prefix. In some cases it wasnt there as supposed. > > > > Now all the prefix-handling should be ok. I've made an yet simple > > test-suite, all available thru > > http://www.zope.org/Members/tino/ > > (See "Patch for " there) > > > > Note: the prefix prepends only the in-tags own variables. Any attribute > > coming from the sequence is untouched. This is also true for statistic > > variables and the magic "mapping" symbol. > > > > While it could easy be implemented, I think prefixing all attributes is > > not such a good idea. If you are ilterating over database queries you > > can rename the attributes there. > > > > ___ > 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] New user - couple of questions
Paolo Quaglia wrote: Hi to all,I'm a new Zope user/developer ... Zope has impressed me very much!Ihave a couple of questions.I want to build a new intranet site for my company using Zope, but:1. How can I import and use Python modules For example I want to use the function sleep(secs) that resides in the time module.I wrote this code: import time def hello(self): sleep(10) return "I'm Back!!" Better if you write this function like this: import time def hello(self): time.sleep(10) return "I'm Back!!" 1. give it a name, say pippo.py 2. then go back to your zope and add an External Method 3. put id=pluto 4. function name=hello 5. python module=pippo 6. save it If you want to try it create a DTML Document for example and put in it the the following command: and then view the DTML Document, after a while i.e. 10 secs you will see the message: I'm Back!! but when I call the external method bounded with the hello function an error occours!!1st. Have I to install the time module? - if yes where can I found it and where can I install it?2nd. How do I have to call the sleep function?2. I want to build an application that use the database transection to update rows.I use SQL server that support DB transactions.where can I build SQL transactions with Zope? do I have to build a ZSQL method with multiple SQL calls? .. for example:... If I am not mistaken, zope works all the time in transaction mode, then you don't need to expecify transactions at all. begin transaction update t_cliente set primaetichinterna = 'mia' commitAm I sure that the transaction will work (if another user use the same method at the same time)?How can I test if a transaction has been committed or aborted?Thanks VERY MUCH in advancePaolo QuagliaSitek Spa Italy Paolo Quaglia Information Technology Coordinator Sitek S.p.A. [EMAIL PROTECTED] Ciao José Soares - Italy
Re: [Zope] how to get the created table names
There isn't a SQL standard command to show the tables in the database. Thus evry database has a different command to do such job. For example: DBMaker: to show TABLES: select * from SYSTABLE to show COLUMNS: SELECT COLUMN_NAME,TYPE_NAME,PRECISION FROM SYSCOLUMN WHERE TABLE_NAME='' MySQL: to show TABLES: SHOW TABLES to show COLUMNS: DESC PostreSQL: to show TABLES: select tablename from pg_tables where tablename not like 'pg_%' to show COLUMNS: SELECT a.attname, t.typname, CASE WHEN a.attlen > 0 THEN attlen ELSE a.atttypmod END as length FROM pg_class c, pg_attribute a, pg_type t WHERE c.relname = '' AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid I wrote a couple of ZSQL Methods to emulate a generic ISQL to query a database using the SQL language which shows the names of every table in the database and every column name, type and length of every table. If you want I can send you it. José subrahmanyan kalathur wrote: > hi, > > I would like to know the names of the created table in zsql method. > Kindly give me the tag for displaying the table names.( if exists.) > > thanks > bye > yours, > > K.H.Subrahmanyan > > ( [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 ) ___ 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] How to access column names in DTML Methods
Great! Thank you very much Curtis. Curtis Maloney wrote: > On Tue, 14 Nov 2000, Jose Soares wrote: > > Hi all, > > > > I'm trying to display the column names of a Record object without success. > > I'm able to access column data using sequence-item but I don't know > > how to display column names. > > > > > > Here is some code I use in a production site: > > > > do your loop stuff here > > > > I only used the dtml-let because I use the list twice... so; > > > blah > > > should work fine (not testsed.) I believe there is some more detail in what > exactly is in an SQL return object (try the ZQR :) > > > > > Thanks for any help > > José > > > > Have a better one, > Curtis Maloney > > ___ > 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] How to access column names in DTML Methods
Hi all, I'm trying to display the column names of a Record object without success. I'm able to access column data using sequence-item but I don't know how to display column names. (Previous results) ?HEADER (Next results) There was no data matching this query. Thanks for any help José ___ 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] getProperty()
Hi all, This is a newbie question. I'm trying to get the 'title' property of a SQLConnectionIDs. I can do this work using python but in zope I can't do it. I want to create an html SELECT object to display a list of all SQL Connections and I want to display the id and the title, like this: id title - - gadfly Gadfly_database_connection mysql MySQL_database_connection postgres PyGres_database_connection dbmaker DBMaker_database_connection I tryed the following: but sequence-key and sequence-item are equals. Thank for any help Jose' ___ 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 )