Re: [Zope] SQL and Python Products

2013-01-16 Thread robert rottermann

Hi Luiz,
use  sqlalchemy together with z3c.saconfig.
Powerfull, flexible, easy to use ..

And in martin aspelis book is a chapter how to use them ..

robert

On 01/16/2013 07:34 PM, Luiz Pasqual wrote:

Hi,

We are trying to migrate a very old application on Zope 2.9, first we 
thought to migrate to Python Products and then upgrade Zope.


We don't know what's the best way to deal with SQL querys in Python 
products. He is some options we are evaluating:


- SQLAlchemy, leaving behind ZSQLMethods e Zope DA's
- Psycopg
- Python code access a Zope DA inside Zope

So, what you guys think?

Thanks.

--
Luiz Fernando Pasqual S. Souza
mail: l...@pasquall.com 


___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
  https://mail.zope.org/mailman/listinfo/zope-announce
  https://mail.zope.org/mailman/listinfo/zope-dev )


___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] SQL and Python Products

2013-01-16 Thread Niels Dettenbach
Am Mittwoch, 16. Januar 2013, 16:34:01 schrieb Luiz Pasqual:
> We are trying to migrate a very old application on Zope 2.9, first we
> thought to migrate to Python Products and then upgrade Zope.
> 
> We don't know what's the best way to deal with SQL querys in Python
> products. He is some options we are evaluating:
> 
> - SQLAlchemy, leaving behind ZSQLMethods e Zope DA's
> - Psycopg
> - Python code access a Zope DA inside Zope
> 
> So, what you guys think?

I mainly use MySQL with Zope with the ZMySQL Database Adapter... Not shure if 
that something you're looking for.

hth
best regards,


Niels.

-- 
 ---
 Niels Dettenbach
 Syndicat IT & Internet
 http://www.syndicat.com
 PGP: https://syndicat.com/pub_key.asc
 ---
 





signature.asc
Description: This is a digitally signed message part.
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] SQL and Python Products

2013-01-16 Thread Luiz Pasqual
Hi,

We are trying to migrate a very old application on Zope 2.9, first we
thought to migrate to Python Products and then upgrade Zope.

We don't know what's the best way to deal with SQL querys in Python
products. He is some options we are evaluating:

- SQLAlchemy, leaving behind ZSQLMethods e Zope DA's
- Psycopg
- Python code access a Zope DA inside Zope

So, what you guys think?

Thanks.

-- 
Luiz Fernando Pasqual S. Souza
mail: l...@pasquall.com
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] SQL Method running twice

2009-12-17 Thread Sascha Welter
(Tue, Dec 15, 2009 at 02:10:17PM -0600) Justin Dunsworth wrote/schrieb/egrapse:
> I simplified a page and all it's dependencies and added code back one by
> one. It eventually ended up coming down to one tag that was switching
> browser modes and POSTed twice. Switched compatability mode to on with IE8
> and did it with the same tag and it worked fine.
> 
> I removed the tag:  http://www.w3.org/TR/html4/strict.dtd";>

Your document did not comply to what IE8 expects in a HTML 4.01 strict
document. So it goes to "quirks mode" and in its glorious stupidity
reloads the page to do so.

Two things come to mind:

- don't remove the docstring, switch to the correct one - search the
  Intarweb thing for the correct one for IE8 "compatibility mode" and of
  course for your html

- I guess if the request leading to the zsql method that changed things
  in the database was called through a form (and not as a plain link)
  then maybe IE8 wouldn't try to reload

Good luck in any case!

Regards,

Sascha

___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] SQL Method running twice

2009-12-15 Thread Justin Dunsworth
Let me take this a bit further and I hate spamming but if any other person
that has a similar issue can refer to...

I simplified a page and all it's dependencies and added code back one by
one. It eventually ended up coming down to one tag that was switching
browser modes and POSTed twice. Switched compatability mode to on with IE8
and did it with the same tag and it worked fine.

I removed the tag: http://www.w3.org/TR/html4/strict.dtd";>



On Tue, Dec 15, 2009 at 1:09 PM, Justin Dunsworth <
justin.dunswo...@gmail.com> wrote:

> Investigating further the page is actually being posted twice. This was due
> to javascript and not the database, transactions, or otherwise.
>
> On Tue, Dec 15, 2009 at 11:50 AM, Andreas Jung  wrote:
>
>> -BEGIN PGP SIGNED MESSAGE-
>> Hash: SHA1
>>
>> Please re-read my answer.
>>
>> Andreas
>>
>> schrieb Justin Dunsworth:
>>  > This seems to be happening on more than just one query now... is
>> > there any suggestion on where to look?
>> >
>> > On Thu, Dec 10, 2009 at 1:14 PM, Justin Dunsworth <
>> > justin.dunswo...@gmail.com> wrote:
>> >
>> >> Thanks for the reply... Are you suggesting that there may be an
>> >> issue with MySQL receiving the data from zope and the way it
>> >> handles it?
>> >>
>> >> Strange thing is that I'm using the exact same method I have used
>> >> thousands of times over and same code layout and this is the
>> >> first time I'm seeing it. I've changed around a few things
>> >> relating to variable names etc thinking it was the case but
>> >> dumbing it down to the simplest way I can still is giving the
>> >> error.
>> >>
>> >> On Thu, Dec 10, 2009 at 1:03 PM, Andreas Jung 
>> >> wrote:
>> >>
>> >>> In case of a ZODB conflict error the whole request will be
>> >>> repeat up to three times. If you database does not provide
>> >>> proper transaction support (trible check your MySQL
>> >>> installation and your table type useage), you're doomed. A
>> >>> proper RDBMS like Oracle or Postgres will behave properly and
>> >>> abort the transaction in case of a ZODB transaction abort.
>> >>>
>> >>> -aj
>> >>>
>> >>> Am 10.12.09 19:59, schrieb Justin Dunsworth:
>>  I am running into a brand new issue today that I can't, for
>>  the life of me, figure out. I wrote a standard page to insert
>>  data into a MySQL table using Z SQL methods from a form like
>>  I always have but for some strange reason it's running the
>>  same query twice, thus adding a duplicate entry.
>> 
>>  I have confined the original code in it's own document,
>>  checked, double checked, and still no avail. Here's the code
>>  for the page:
>> 
>>    
>>  
>>  
>>   Error while submitting! Status not
>>  added. Error type:  Error
>>  value:>  action="&dtml-URL;" method="post"> >  align="center" width="30%" cellspacing="0" > >  class="tcat" align="center" colspan="2" style="font-size:
>>  12pt;">Add New Status >  align="right">Name:>  type="text" name="name_add" size=15> >  width="35%" align="right"
>>  valign="top">Description:>  width="65%">>  rows=4> >  align="right">Sort:>  type="text" name="sort_add" value="5"
>> >>> size=1>
>>   
>>  
>>   Add
>>  Status   >  onclick="window.location = '/statuses';
>>  return false;">Cancel
>>  
>> 
>>  I can run the SQL Method by itself and it works just fine
>>  (only inserting it once) but when run as a separate page it
>>  adds the two.
>> 
>>  Any assistance is appreciated
>> 
>> 
>>  ___ Zope maillist
>>  -  Zope@zope.org https://mail.zope.org/mailman/listinfo/zope
>>  **   No cross posts or HTML encoding!  ** (Related lists -
>>  https://mail.zope.org/mailman/listinfo/zope-announce
>>  https://mail.zope.org/mailman/listinfo/zope-dev )
>> 
>> >>>
>> >>> -- ZOPYX Ltd. & Co KG  \  zopyx group Charlottenstr.
>> >>> 37/1  \  The full-service network for your D-72070
>> >>> Tübingen  \  Python, Zope and Plone projects
>> >>> www.zopyx.com, i...@zopyx.com  \  www.zopyxgroup.com
>> >>>
>> 
>> >>>
>> >>>
>> E-Publishing, Python, Zope & Plone development, Consulting
>> >>>
>> >>>
>> >>>
>> >
>> >
>> > --
>> >
>> >
>> >
>> ___
>> > Zope maillist  -  Zope@zope.org
>> > https://mail.zope.org/mailman/listinfo/zope **   No cross posts or
>> > HTML encoding!  ** (Related lists -
>> > https://mail.zope.org/mailman/listinfo/zope-announce
>> > https://mail.zope.org/mailman/listinfo/zope-dev )
>>
>>
>> - --
>> ZOPYX Ltd. & Co KG \ zopyx group
>> Charlottenstr. 37/1 \ The full-service network for your
>> D-72070 Tübingen \ Python, Zope and Plone projects
>> www.zopyx.com, i...@zopyx.com \ www.zopyxgroup.com

Re: [Zope] SQL Method running twice

2009-12-15 Thread Justin Dunsworth
Investigating further the page is actually being posted twice. This was due
to javascript and not the database, transactions, or otherwise.

On Tue, Dec 15, 2009 at 11:50 AM, Andreas Jung  wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Please re-read my answer.
>
> Andreas
>
> schrieb Justin Dunsworth:
>  > This seems to be happening on more than just one query now... is
> > there any suggestion on where to look?
> >
> > On Thu, Dec 10, 2009 at 1:14 PM, Justin Dunsworth <
> > justin.dunswo...@gmail.com> wrote:
> >
> >> Thanks for the reply... Are you suggesting that there may be an
> >> issue with MySQL receiving the data from zope and the way it
> >> handles it?
> >>
> >> Strange thing is that I'm using the exact same method I have used
> >> thousands of times over and same code layout and this is the
> >> first time I'm seeing it. I've changed around a few things
> >> relating to variable names etc thinking it was the case but
> >> dumbing it down to the simplest way I can still is giving the
> >> error.
> >>
> >> On Thu, Dec 10, 2009 at 1:03 PM, Andreas Jung 
> >> wrote:
> >>
> >>> In case of a ZODB conflict error the whole request will be
> >>> repeat up to three times. If you database does not provide
> >>> proper transaction support (trible check your MySQL
> >>> installation and your table type useage), you're doomed. A
> >>> proper RDBMS like Oracle or Postgres will behave properly and
> >>> abort the transaction in case of a ZODB transaction abort.
> >>>
> >>> -aj
> >>>
> >>> Am 10.12.09 19:59, schrieb Justin Dunsworth:
>  I am running into a brand new issue today that I can't, for
>  the life of me, figure out. I wrote a standard page to insert
>  data into a MySQL table using Z SQL methods from a form like
>  I always have but for some strange reason it's running the
>  same query twice, thus adding a duplicate entry.
> 
>  I have confined the original code in it's own document,
>  checked, double checked, and still no avail. Here's the code
>  for the page:
> 
>    
>  
>  
>   Error while submitting! Status not
>  added. Error type:  Error
>  value:  action="&dtml-URL;" method="post">   align="center" width="30%" cellspacing="0" >   class="tcat" align="center" colspan="2" style="font-size:
>  12pt;">Add New Status   align="right">Name:  type="text" name="name_add" size=15>   width="35%" align="right"
>  valign="top">Description:  width="65%">  rows=4>   align="right">Sort:  type="text" name="sort_add" value="5"
> >>> size=1>
>   
>  
>   Add
>  Status     onclick="window.location = '/statuses';
>  return false;">Cancel
>  
> 
>  I can run the SQL Method by itself and it works just fine
>  (only inserting it once) but when run as a separate page it
>  adds the two.
> 
>  Any assistance is appreciated
> 
> 
>  ___ Zope maillist
>  -  Zope@zope.org https://mail.zope.org/mailman/listinfo/zope
>  **   No cross posts or HTML encoding!  ** (Related lists -
>  https://mail.zope.org/mailman/listinfo/zope-announce
>  https://mail.zope.org/mailman/listinfo/zope-dev )
> 
> >>>
> >>> -- ZOPYX Ltd. & Co KG  \  zopyx group Charlottenstr.
> >>> 37/1  \  The full-service network for your D-72070
> >>> Tübingen  \  Python, Zope and Plone projects
> >>> www.zopyx.com, i...@zopyx.com  \  www.zopyxgroup.com
> >>>
> 
> >>>
> >>>
> E-Publishing, Python, Zope & Plone development, Consulting
> >>>
> >>>
> >>>
> >
> >
> > --
> >
> >
> >
> ___
> > Zope maillist  -  Zope@zope.org
> > https://mail.zope.org/mailman/listinfo/zope **   No cross posts or
> > HTML encoding!  ** (Related lists -
> > https://mail.zope.org/mailman/listinfo/zope-announce
> > https://mail.zope.org/mailman/listinfo/zope-dev )
>
>
> - --
> ZOPYX Ltd. & Co KG \ zopyx group
> Charlottenstr. 37/1 \ The full-service network for your
> D-72070 Tübingen \ Python, Zope and Plone projects
> www.zopyx.com, i...@zopyx.com \ www.zopyxgroup.com
> - 
> E-Publishing, Python, Zope & Plone development, Consulting
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.10 (Darwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAksnzGMACgkQCJIWIbr9KYwPlACg1ddItBhsM1dT10Iq9pE/ULgE
> RwkAoOfg9NdwZKdvx9DqSWfK91X1myTh
> =x0AL
> -END PGP SIGNATURE-
>
>
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https:/

Re: [Zope] SQL Method running twice

2009-12-15 Thread Andreas Jung
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Please re-read my answer.

Andreas

schrieb Justin Dunsworth:
> This seems to be happening on more than just one query now... is
> there any suggestion on where to look?
>
> On Thu, Dec 10, 2009 at 1:14 PM, Justin Dunsworth <
> justin.dunswo...@gmail.com> wrote:
>
>> Thanks for the reply... Are you suggesting that there may be an
>> issue with MySQL receiving the data from zope and the way it
>> handles it?
>>
>> Strange thing is that I'm using the exact same method I have used
>> thousands of times over and same code layout and this is the
>> first time I'm seeing it. I've changed around a few things
>> relating to variable names etc thinking it was the case but
>> dumbing it down to the simplest way I can still is giving the
>> error.
>>
>> On Thu, Dec 10, 2009 at 1:03 PM, Andreas Jung 
>> wrote:
>>
>>> In case of a ZODB conflict error the whole request will be
>>> repeat up to three times. If you database does not provide
>>> proper transaction support (trible check your MySQL
>>> installation and your table type useage), you're doomed. A
>>> proper RDBMS like Oracle or Postgres will behave properly and
>>> abort the transaction in case of a ZODB transaction abort.
>>>
>>> -aj
>>>
>>> Am 10.12.09 19:59, schrieb Justin Dunsworth:
 I am running into a brand new issue today that I can't, for
 the life of me, figure out. I wrote a standard page to insert
 data into a MySQL table using Z SQL methods from a form like
 I always have but for some strange reason it's running the
 same query twice, thus adding a duplicate entry.

 I have confined the original code in it's own document,
 checked, double checked, and still no avail. Here's the code
 for the page:

   
 
 
  Error while submitting! Status not
 added. Error type:  Error
 value:>>> action="&dtml-URL;" method="post"> >>> align="center" width="30%" cellspacing="0" > >>> class="tcat" align="center" colspan="2" style="font-size:
 12pt;">Add New Status >>> align="right">Name:>>> type="text" name="name_add" size=15> >>> width="35%" align="right"
 valign="top">Description:>>> width="65%" rows=4> >>> align="right">Sort:>>> type="text" name="sort_add" value="5"
>>> size=1>
  
 
  Add
 Status   >>> onclick="window.location = '/statuses';
 return false;">Cancel
 

 I can run the SQL Method by itself and it works just fine
 (only inserting it once) but when run as a separate page it
 adds the two.

 Any assistance is appreciated


 ___ Zope maillist
 -  Zope@zope.org https://mail.zope.org/mailman/listinfo/zope
 **   No cross posts or HTML encoding!  ** (Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )

>>>
>>> -- ZOPYX Ltd. & Co KG  \  zopyx group Charlottenstr.
>>> 37/1  \  The full-service network for your D-72070
>>> Tübingen  \  Python, Zope and Plone projects
>>> www.zopyx.com, i...@zopyx.com  \  www.zopyxgroup.com
>>> 
>>>
>>>
E-Publishing, Python, Zope & Plone development, Consulting
>>>
>>>
>>>
>
>
> --
>
>
>
___
> Zope maillist  -  Zope@zope.org
> https://mail.zope.org/mailman/listinfo/zope **   No cross posts or
> HTML encoding!  ** (Related lists -
> https://mail.zope.org/mailman/listinfo/zope-announce
> https://mail.zope.org/mailman/listinfo/zope-dev )


- -- 
ZOPYX Ltd. & Co KG \ zopyx group
Charlottenstr. 37/1 \ The full-service network for your
D-72070 Tübingen \ Python, Zope and Plone projects
www.zopyx.com, i...@zopyx.com \ www.zopyxgroup.com
- 
E-Publishing, Python, Zope & Plone development, Consulting

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksnzGMACgkQCJIWIbr9KYwPlACg1ddItBhsM1dT10Iq9pE/ULgE
RwkAoOfg9NdwZKdvx9DqSWfK91X1myTh
=x0AL
-END PGP SIGNATURE-

<>___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] SQL Method running twice

2009-12-15 Thread Justin Dunsworth
I forgot to add version:

Zope 2.11.4-final, python 2.4.4, win32 and using ZMySQLDA 2.0.9

On Tue, Dec 15, 2009 at 11:34 AM, Justin Dunsworth <
justin.dunswo...@gmail.com> wrote:

> This seems to be happening on more than just one query now... is there any
> suggestion on where to look?
>
>
> On Thu, Dec 10, 2009 at 1:14 PM, Justin Dunsworth <
> justin.dunswo...@gmail.com> wrote:
>
>> Thanks for the reply... Are you suggesting that there may be an issue with
>> MySQL receiving the data from zope and the way it handles it?
>>
>> Strange thing is that I'm using the exact same method I have used
>> thousands of times over and same code layout and this is the first time I'm
>> seeing it. I've changed around a few things relating to variable names etc
>> thinking it was the case but dumbing it down to the simplest way I can still
>> is giving the error.
>>
>>  On Thu, Dec 10, 2009 at 1:03 PM, Andreas Jung  wrote:
>>
>>> In case of a ZODB conflict error the whole request will be repeat up to
>>> three times.
>>> If you database does not provide proper transaction support (trible
>>> check your MySQL
>>> installation and your table type useage), you're doomed. A proper RDBMS
>>> like Oracle
>>> or Postgres will behave properly and abort the transaction in case of a
>>> ZODB transaction
>>> abort.
>>>
>>> -aj
>>>
>>> Am 10.12.09 19:59, schrieb Justin Dunsworth:
>>>  > I am running into a brand new issue today that I can't, for the life
>>> > of me, figure out. I wrote a standard page to insert data into a MySQL
>>> > table using Z SQL methods from a form like I always have but for some
>>> > strange reason it's running the same query twice, thus adding a
>>> > duplicate entry.
>>> >
>>> > I have confined the original code in it's own document, checked,
>>> > double checked, and still no avail. Here's the code for the page:
>>> >
>>> > 
>>> > 
>>> >   
>>> > 
>>> > 
>>> >   
>>> > Error while submitting! Status not added.
>>> > Error type: 
>>> > Error value: 
>>> >   
>>> > 
>>> > 
>>> >   
>>> > Add New Status
>>> > Name:>> > width="65%">
>>> > >> > valign="top">Description:>> > name="description_add" cols=25 rows=4>
>>> > Sort:>> > width="65%">>> size=1>
>>> > 
>>> > 
>>> >   
>>> >   
>>> > Add
>>> > Status  
>>> > Cancel
>>> >   
>>> > 
>>> >   
>>> > 
>>> > 
>>> >
>>> > I can run the SQL Method by itself and it works just fine (only
>>> > inserting it once) but when run as a separate page it adds the two.
>>> >
>>> > Any assistance is appreciated
>>> >
>>> >
>>> > ___
>>> > Zope maillist  -  Zope@zope.org
>>> > https://mail.zope.org/mailman/listinfo/zope
>>> > **   No cross posts or HTML encoding!  **
>>> > (Related lists -
>>> >  https://mail.zope.org/mailman/listinfo/zope-announce
>>> >  https://mail.zope.org/mailman/listinfo/zope-dev )
>>> >
>>>
>>>
>>> --
>>> ZOPYX Ltd. & Co KG  \  zopyx group
>>> Charlottenstr. 37/1  \  The full-service network for your
>>> D-72070 Tübingen  \  Python, Zope and Plone projects
>>> www.zopyx.com, i...@zopyx.com  \  www.zopyxgroup.com
>>> 
>>> E-Publishing, Python, Zope & Plone development, Consulting
>>>
>>>
>>>
>>
>
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] SQL Method running twice

2009-12-15 Thread Justin Dunsworth
This seems to be happening on more than just one query now... is there any
suggestion on where to look?

On Thu, Dec 10, 2009 at 1:14 PM, Justin Dunsworth <
justin.dunswo...@gmail.com> wrote:

> Thanks for the reply... Are you suggesting that there may be an issue with
> MySQL receiving the data from zope and the way it handles it?
>
> Strange thing is that I'm using the exact same method I have used thousands
> of times over and same code layout and this is the first time I'm seeing it.
> I've changed around a few things relating to variable names etc thinking it
> was the case but dumbing it down to the simplest way I can still is giving
> the error.
>
>  On Thu, Dec 10, 2009 at 1:03 PM, Andreas Jung  wrote:
>
>> In case of a ZODB conflict error the whole request will be repeat up to
>> three times.
>> If you database does not provide proper transaction support (trible
>> check your MySQL
>> installation and your table type useage), you're doomed. A proper RDBMS
>> like Oracle
>> or Postgres will behave properly and abort the transaction in case of a
>> ZODB transaction
>> abort.
>>
>> -aj
>>
>> Am 10.12.09 19:59, schrieb Justin Dunsworth:
>>  > I am running into a brand new issue today that I can't, for the life
>> > of me, figure out. I wrote a standard page to insert data into a MySQL
>> > table using Z SQL methods from a form like I always have but for some
>> > strange reason it's running the same query twice, thus adding a
>> > duplicate entry.
>> >
>> > I have confined the original code in it's own document, checked,
>> > double checked, and still no avail. Here's the code for the page:
>> >
>> > 
>> > 
>> >   
>> > 
>> > 
>> >   
>> > Error while submitting! Status not added.
>> > Error type: 
>> > Error value: 
>> >   
>> > 
>> > 
>> >   
>> > Add New Status
>> > Name:> > width="65%">
>> > > > valign="top">Description:> > name="description_add" cols=25 rows=4>
>> > Sort:> > width="65%">> size=1>
>> > 
>> > 
>> >   
>> >   
>> > Add
>> > Status  
>> > Cancel
>> >   
>> > 
>> >   
>> > 
>> > 
>> >
>> > I can run the SQL Method by itself and it works just fine (only
>> > inserting it once) but when run as a separate page it adds the two.
>> >
>> > Any assistance is appreciated
>> >
>> >
>> > ___
>> > Zope maillist  -  Zope@zope.org
>> > https://mail.zope.org/mailman/listinfo/zope
>> > **   No cross posts or HTML encoding!  **
>> > (Related lists -
>> >  https://mail.zope.org/mailman/listinfo/zope-announce
>> >  https://mail.zope.org/mailman/listinfo/zope-dev )
>> >
>>
>>
>> --
>> ZOPYX Ltd. & Co KG  \  zopyx group
>> Charlottenstr. 37/1  \  The full-service network for your
>> D-72070 Tübingen  \  Python, Zope and Plone projects
>> www.zopyx.com, i...@zopyx.com  \  www.zopyxgroup.com
>> 
>> E-Publishing, Python, Zope & Plone development, Consulting
>>
>>
>>
>
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] SQL Method running twice

2009-12-10 Thread Justin Dunsworth
Thanks for the reply... Are you suggesting that there may be an issue with
MySQL receiving the data from zope and the way it handles it?

Strange thing is that I'm using the exact same method I have used thousands
of times over and same code layout and this is the first time I'm seeing it.
I've changed around a few things relating to variable names etc thinking it
was the case but dumbing it down to the simplest way I can still is giving
the error.

On Thu, Dec 10, 2009 at 1:03 PM, Andreas Jung  wrote:

> In case of a ZODB conflict error the whole request will be repeat up to
> three times.
> If you database does not provide proper transaction support (trible
> check your MySQL
> installation and your table type useage), you're doomed. A proper RDBMS
> like Oracle
> or Postgres will behave properly and abort the transaction in case of a
> ZODB transaction
> abort.
>
> -aj
>
> Am 10.12.09 19:59, schrieb Justin Dunsworth:
>  > I am running into a brand new issue today that I can't, for the life
> > of me, figure out. I wrote a standard page to insert data into a MySQL
> > table using Z SQL methods from a form like I always have but for some
> > strange reason it's running the same query twice, thus adding a
> > duplicate entry.
> >
> > I have confined the original code in it's own document, checked,
> > double checked, and still no avail. Here's the code for the page:
> >
> > 
> > 
> >   
> > 
> > 
> >   
> > Error while submitting! Status not added.
> > Error type: 
> > Error value: 
> >   
> > 
> > 
> >   
> > Add New Status
> > Name: > width="65%">
> >  > valign="top">Description: > name="description_add" cols=25 rows=4>
> > Sort: > width="65%"> size=1>
> > 
> > 
> >   
> >   
> > Add
> > Status  
> > Cancel
> >   
> > 
> >   
> > 
> > 
> >
> > I can run the SQL Method by itself and it works just fine (only
> > inserting it once) but when run as a separate page it adds the two.
> >
> > Any assistance is appreciated
> >
> >
> > ___
> > Zope maillist  -  Zope@zope.org
> > https://mail.zope.org/mailman/listinfo/zope
> > **   No cross posts or HTML encoding!  **
> > (Related lists -
> >  https://mail.zope.org/mailman/listinfo/zope-announce
> >  https://mail.zope.org/mailman/listinfo/zope-dev )
> >
>
>
> --
> ZOPYX Ltd. & Co KG  \  zopyx group
> Charlottenstr. 37/1  \  The full-service network for your
> D-72070 Tübingen  \  Python, Zope and Plone projects
> www.zopyx.com, i...@zopyx.com  \  www.zopyxgroup.com
> 
> E-Publishing, Python, Zope & Plone development, Consulting
>
>
>
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] SQL Method running twice

2009-12-10 Thread Andreas Jung
In case of a ZODB conflict error the whole request will be repeat up to
three times.
If you database does not provide proper transaction support (trible
check your MySQL
installation and your table type useage), you're doomed. A proper RDBMS
like Oracle
or Postgres will behave properly and abort the transaction in case of a
ZODB transaction
abort.

-aj

Am 10.12.09 19:59, schrieb Justin Dunsworth:
> I am running into a brand new issue today that I can't, for the life
> of me, figure out. I wrote a standard page to insert data into a MySQL
> table using Z SQL methods from a form like I always have but for some
> strange reason it's running the same query twice, thus adding a
> duplicate entry.
>  
> I have confined the original code in it's own document, checked,
> double checked, and still no avail. Here's the code for the page:
>  
> 
> 
>   
> 
> 
>   
> Error while submitting! Status not added.
> Error type: 
> Error value: 
>   
> 
> 
>   
> Add New Status
> Name: width="65%">
>  valign="top">Description: name="description_add" cols=25 rows=4>
> Sort: width="65%">
> 
> 
>   
>   
> Add
> Status  
> Cancel
>   
> 
>   
> 
> 
>  
> I can run the SQL Method by itself and it works just fine (only
> inserting it once) but when run as a separate page it adds the two.
>  
> Any assistance is appreciated
>
>
> ___
> Zope maillist  -  Zope@zope.org
> https://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  https://mail.zope.org/mailman/listinfo/zope-announce
>  https://mail.zope.org/mailman/listinfo/zope-dev )
>   


-- 
ZOPYX Ltd. & Co KG  \  zopyx group
Charlottenstr. 37/1  \  The full-service network for your 
D-72070 Tübingen  \  Python, Zope and Plone projects
www.zopyx.com, i...@zopyx.com  \  www.zopyxgroup.com

E-Publishing, Python, Zope & Plone development, Consulting


<>___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] SQL Method running twice

2009-12-10 Thread Justin Dunsworth
I am running into a brand new issue today that I can't, for the life of me,
figure out. I wrote a standard page to insert data into a MySQL table using
Z SQL methods from a form like I always have but for some strange reason
it's running the same query twice, thus adding a duplicate entry.

I have confined the original code in it's own document, checked, double
checked, and still no avail. Here's the code for the page:



  


  
Error while submitting! Status not added.
Error type: 
Error value: 
  


  
Add New Status
Name:
Description:
Sort:


  
  
Add
Status  
Cancel
  

  



I can run the SQL Method by itself and it works just fine (only inserting it
once) but when run as a separate page it adds the two.

Any assistance is appreciated
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] sql and auto generated forms

2007-09-16 Thread garry saddington
On Sun, 2007-09-16 at 09:24 +0200, Dieter Maurer wrote:
> Jaroslav Lukesh wrote at 2007-9-14 19:50 +0200:
> >I looking for such a tool, for which I define table columns and this tool 
> >generates SQL create,insert, update, select ZSQL methods and generate forms 
> >with methods for insert, update and show records.
> >
> >It exists, or some similar, please? I have bunch of tables...
> 
> We used (for some time) a product with a name similar to
> "ZSolkWizzard" for this (the name is definitely different, but
> I do not know the correct one).
> 
> 
> 
Znolk SQL Wizard
http://www.zope.org/Members/zwork/Znolk_SQL_Wizard

regards
Garry

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] sql and auto generated forms

2007-09-16 Thread Dieter Maurer
Jaroslav Lukesh wrote at 2007-9-14 19:50 +0200:
>I looking for such a tool, for which I define table columns and this tool 
>generates SQL create,insert, update, select ZSQL methods and generate forms 
>with methods for insert, update and show records.
>
>It exists, or some similar, please? I have bunch of tables...

We used (for some time) a product with a name similar to
"ZSolkWizzard" for this (the name is definitely different, but
I do not know the correct one).



-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] sql and auto generated forms

2007-09-14 Thread Jaroslav Lukesh
Hi,

I looking for such a tool, for which I define table columns and this tool 
generates SQL create,insert, update, select ZSQL methods and generate forms 
with methods for insert, update and show records.

It exists, or some similar, please? I have bunch of tables...

Many thanks, JL. 
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] sql and script python

2007-03-13 Thread Tino Wildenhain

javi lopez schrieb:

hello everyone:

how to create a query(mysql) inside script python


You dont. You write your Query into a ZSQL Method and
call it as function in your python script.

Regards
Tino
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] sql and script python

2007-03-13 Thread javi lopez

hello everyone:

how to create a query(mysql) inside script python
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] SQL Server Network Error

2007-03-09 Thread Dieter Maurer
David VanKirk wrote at 2007-3-8 10:08 -0500:
>I have Zope and SQL Server setup on the same machine, with no firewall
>running on that PC, so there is no firewall between the two.
>Occasionally I will get the following error, upon refreshing the page
>the error disappears.
>
>Error Type: ReplayTransaction
>Error Value: OperationalError on : ('08S01', 11, '[Microsoft][ODBC SQL
>Server Driver][Shared Memory]General network error. Check your network
>documentation.', 6108)

Your "ODBC SQL Server Driver" tells you about a "General network error".

I fear the Zope community will be unable to help you understand
this error message.

I see two possibilities:

  1.  the message from your "ODBC SQL Server Driver" is wrong.

  In this case, you need an expert for this driver (maybe,
  the support from the respective company)

  2.  the message is right. Then you need a network expert,
  that can (locally!) analyse your network to understand
  what happens.



-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] SQL Server Network Error

2007-03-08 Thread David VanKirk

I have Zope and SQL Server setup on the same machine, with no firewall
running on that PC, so there is no firewall between the two.
Occasionally I will get the following error, upon refreshing the page
the error disappears.

Error Type: ReplayTransaction
Error Value: OperationalError on : ('08S01', 11, '[Microsoft][ODBC SQL
Server Driver][Shared Memory]General network error. Check your network
documentation.', 6108)

I found somewhere that this could be caused by a firewall, but, like I
said, there is no firewall between Zope and SQL Server.

Can anyone help me fix the problem, or at least explain why it might
be happening?

I'm using Zope 2.6.4, SQL Server 2000, and I'm using egenix's mxODBC driver.

--
David VanKirk
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] SQL transaction uncommited?

2005-12-19 Thread Vlada Macek

[At 19.12.2005 01:39, Gabriel Genellina kindly sent the following
quotation.]


Gabriel, I appreciate you also reviewed my code.


>> def manage_afterAdd(self, item, container): if item is self:
>> self.db = getattr(self,MY_CONNECTION_ID)._v_database_connection
>
> Keeping a _v_ attribute is *not* a good idea - it's suposed to be
> *volatile*.

Later I moved the connection obj lookup to qry() method, so the
volatility of the attribute is not an issue now. I also learnt from
Shared/DC/ZRDB/Connection.py what you were talking about and changed
"._v_database_connection" to "()", which definitely looks cleaner. :-)

>> def qry(self, query): results = self.db.query(query) recs = {
>> 'names': Results(results).names(), 'tuples':
>> Results(results).tuples() } return recs
>
> Why create a Results object twice? results =
> Results(self.db.query(query))...

I also fixed this overlook later, thanks.

> I don't know how the ProgressSQL adapter is implemented, but *if*
> every query() call created a different connection or started a
> different transaction -which does not complete until the Zope
> transaction commits finally- *then* you would see those results.
> Updates made by the *same* transaction should always be available to
> that transaction, whatever the trans. isolation level in use. If this
> was the case, that may indicate that the Progress adapter is not
> properly written.

On psycopg mailing list I was informed that my problem is a known issue
of version 2.0b6 and that I should wait for b7 or take SVN head.

People, do not trust everything you are told on IRC. Sometimes it's
better to stay with stable releases, psycopg 1.1.18 works great and as
expected. :-)


-- 

\//\/\
(Sometimes credited as 1494 F8DD 6379 4CD7 E7E3 1FC9 D750 4243 1F05 9424.)

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] SQL transaction uncommited?

2005-12-18 Thread Gabriel Genellina

At Saturday 17/12/2005 09:31, Vlada Macek wrote:


in ZopeBook I read that Zope's transaction are tied to SQL backend's
ones. I do not know whether this applies to ZSQL methods only, but I
do not expect it. I got this table:




def manage_afterAdd(self, item, container):
if item is self:
self.db = getattr(self,MY_CONNECTION_ID)._v_database_connection


Keeping a _v_ attribute is *not* a good idea - it's suposed to be *volatile*.
It's not clear from this partial fragment, but if self inherits from 
Connection, use __call__ instead -i.e. place a () after the object- to 
obtain its database connection (using __call__ ensures that the connection 
is open).



def qry(self, query):
results = self.db.query(query)
recs = {
'names': Results(results).names(),
'tuples': Results(results).tuples()
}
return recs


Why create a Results object twice?
results = Results(self.db.query(query))...



def test0(self):
self.qry('insert into testtable (n) values (10)')

def test1(self):
self.qry('insert into testtable (n) values (10)')
self.db.commit()

def test2(self):
self.qry('insert into testtable (n) values (10)')
self.qry('commit')

def test3(self):
self.qry('insert into testtable (n) values (10)')
return self.qry('select * from testtable')

def test4(self):
self.qry('insert into testtable (n) values (10); commit')

def test5(self):
self.qry('insert into testtable (n) values (10); commit')
return self.qry('select * from testtable')

When I call test0,1,2,3 -- the inserted row is not visible in psql,
but the sequence is incremented! I'm afraid there is some pending
transaction I cannot reach at that moment anymore.

The test4,5 properly add the row to table (and increment the seq of
course) as I can watch via psql immediatelly.

In test3 the returned result does not contain the new row, in test5
the new row is contained in select.


I don't know how the ProgressSQL adapter is implemented, but *if* every 
query() call created a different connection or started a different 
transaction -which does not complete until the Zope transaction commits 
finally- *then* you would see those results.
Updates made by the *same* transaction should always be available to that 
transaction, whatever the trans. isolation level in use.
If this was the case, that may indicate that the Progress adapter is not 
properly written.



What am I doing wrong and how must I arrange it not need to care about
transactions at all? I expected the SQL transactions are transparent
in Zope and they are either commited when the webbrowser gets the
no-exception response and rolled back otherwise.


I've only used the ZODBCDA adapter and it does not show these phenomena; 
its SQL transactions *are* coupled to the Zope transaction (I learned that 
the hard way, in a corner case...)



Gabriel Genellina
Softlab SRL 


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] SQL transaction uncommited?

2005-12-17 Thread Vlada Macek
[At 17.12.2005 15:37, Vlada Macek kindly sent the following quotation.]

>What is serious here is the first connection with my statement is not
>committed. I think this is a bug, probably in ZPsycopgDA.
>  
>
Downgrading psycopg to 1.1.18 solved my problem with pending
transactions. I'm going to post a report to the psycopg mailing list.

-- 

\//\/\
(Sometimes credited as 1494 F8DD 6379 4CD7 E7E3 1FC9 D750 4243 1F05 9424.)


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] SQL transaction uncommited?

2005-12-17 Thread Vlada Macek
[At 17.12.2005 15:17, Tino Wildenhain kindly sent the following quotation.]

>>In the meanwhile I also discovered that when I put my 'insert into
>>testtable...' to ZSQL method, the behavior is the same -- psql does not
>>see new row, but the sequence is incremented. Now it's strange, isn't?
>>
>>
>Actually not. sequences are incremented under any circumstances.
>Thats per definition.
>  
>
By strange I meant the behaviour of ZSQL method is the same as my
product's. The seq incrementation is of course good thing. :-)

>  
>
>>With each ZSQL method call I now found out that a new connection to the
>>database is keeping opened and RowExclusiveLock for testtable and
>>AccessShareLock for its sequence is pending. In now have tens of
>>connections and locks from my tryings. I may did some error in
>>configuration, but I have no clue where and which.
>>
>>Python 2.3.5, Zope 2.7.5-final, psycopg2-2.0b6, PostgreSQL 8.1.
>>
>>
>
>If all goes well and no exception bubbles up to the
>zpublisher, it commits that transaction - both on zope and
>the database. In your case something seems to prevent that,
>this could be an error from one of your queries which you
>swallow in some try:/except: somewhere?
>
>Maybe you can lay out a simple test case where this happens.
>  
>
After a further investigation, the test case is fairly narrow now:

I create a ZPsycopgDA (2.0b6) connection object (txn mode SERIALIZABLE).
I create a ZSQL method bound to this connection and containing "insert
into testtable (n) values 1". When I use the Test tab to execute the
method, command executes ok ("This statement returned no results."). And
the statement log of PostgreSQL shows:

Dec 17 15:22:09 postgres[19407]: [2-1] LOG:  connection received:
host=127.0.0.1 port=36685
Dec 17 15:22:09 postgres[19407]: [3-1] LOG:  connection authorized:
user=tuttle database=his
Dec 17 15:22:09 postgres[19407]: [4-1] LOG:  statement: SET DATESTYLE TO
'ISO'
Dec 17 15:22:09 postgres[19407]: [5-1] LOG:  statement: SHOW client_encoding
Dec 17 15:22:09 postgres[19407]: [6-1] LOG:  statement: SHOW
default_transaction_isolation
Dec 17 15:22:09 postgres[19407]: [7-1] LOG:  statement: BEGIN; SET
TRANSACTION ISOLATION LEVEL SERIALIZABLE
Dec 17 15:22:09 postgres[19407]: [8-1] LOG:  statement: insert into
testtable (n) values (1)

Dec 17 15:22:09 postgres[19408]: [2-1] LOG:  connection received:
host=127.0.0.1 port=36686
Dec 17 15:22:09 postgres[19408]: [3-1] LOG:  connection authorized:
user=tuttle database=his
Dec 17 15:22:09 postgres[19408]: [4-1] LOG:  statement: SET DATESTYLE TO
'ISO'
Dec 17 15:22:09 postgres[19408]: [5-1] LOG:  statement: SHOW client_encoding
Dec 17 15:22:09 postgres[19408]: [6-1] LOG:  statement: SHOW
default_transaction_isolation

Dec 17 15:22:09 postgres[19409]: [2-1] LOG:  connection received:
host=127.0.0.1 port=36687
Dec 17 15:22:09 postgres[19409]: [3-1] LOG:  connection authorized:
user=tuttle database=his
Dec 17 15:22:10 postgres[19409]: [4-1] LOG:  statement: SET DATESTYLE TO
'ISO'
Dec 17 15:22:10 postgres[19409]: [5-1] LOG:  statement: SHOW client_encoding
Dec 17 15:22:10 postgres[19409]: [6-1] LOG:  statement: SHOW
default_transaction_isolation

So the DA opens three connections forcing postgres to spawn new
processes. I don't know why. These connections are pending there.

What is serious here is the first connection with my statement is not
committed. I think this is a bug, probably in ZPsycopgDA.

Is there some other DA for PostgreSQL which is known to be stable and
with txns working properly? Should I try the psycopg1?

Thanks.

-- 

\//\/\
(Sometimes credited as 1494 F8DD 6379 4CD7 E7E3 1FC9 D750 4243 1F05 9424.)


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] SQL transaction uncommited?

2005-12-17 Thread Tino Wildenhain
Am Samstag, den 17.12.2005, 14:20 +0100 schrieb Vlada Macek:
> [At 17.12.2005 13:49, Andreas Jung kindly sent the following quotation.]
> 
> > Dealing with transaction is the task of the database adapter and not
> > the ZSQL methods. If you need to deal with transactions yourself you
> > must subclass the transaction manager TM and implement the hooks for
> > commit and abort (see TM.py).
> 
> Yes, I looked at TM.py. I should have mentioned that I use ZPsycopgDA
> and ZPsycopgDA/db.py is subclassing and using TM already. So I was
> expecting the _finish() and _abort() are bound to PostgreSQL in the SQL
> connection I use.
> 
> In the meanwhile I also discovered that when I put my 'insert into
> testtable...' to ZSQL method, the behavior is the same -- psql does not
> see new row, but the sequence is incremented. Now it's strange, isn't?

Actually not. sequences are incremented under any circumstances.
Thats per definition.

> With each ZSQL method call I now found out that a new connection to the
> database is keeping opened and RowExclusiveLock for testtable and
> AccessShareLock for its sequence is pending. In now have tens of
> connections and locks from my tryings. I may did some error in
> configuration, but I have no clue where and which.
> 
> Python 2.3.5, Zope 2.7.5-final, psycopg2-2.0b6, PostgreSQL 8.1.

I wonder how you actually call it in context of zope. 
Usually with the first ZSQL method you execute your connection
to the database takes part of zopes transaction machinery.
If all goes well and no exception bubbles up to the
zpublisher, it commits that transaction - both on zope and
the database. In your case something seems to prevent that,
this could be an error from one of your queries which you
swallow in some try:/except: somewhere?

Maybe you can lay out a simple test case where this happens.

Regards
Tino

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] SQL transaction uncommited?

2005-12-17 Thread Vlada Macek
[At 17.12.2005 13:49, Andreas Jung kindly sent the following quotation.]

> Dealing with transaction is the task of the database adapter and not
> the ZSQL methods. If you need to deal with transactions yourself you
> must subclass the transaction manager TM and implement the hooks for
> commit and abort (see TM.py).

Yes, I looked at TM.py. I should have mentioned that I use ZPsycopgDA
and ZPsycopgDA/db.py is subclassing and using TM already. So I was
expecting the _finish() and _abort() are bound to PostgreSQL in the SQL
connection I use.

In the meanwhile I also discovered that when I put my 'insert into
testtable...' to ZSQL method, the behavior is the same -- psql does not
see new row, but the sequence is incremented. Now it's strange, isn't?

With each ZSQL method call I now found out that a new connection to the
database is keeping opened and RowExclusiveLock for testtable and
AccessShareLock for its sequence is pending. In now have tens of
connections and locks from my tryings. I may did some error in
configuration, but I have no clue where and which.

Python 2.3.5, Zope 2.7.5-final, psycopg2-2.0b6, PostgreSQL 8.1.

-- 

\//\/\
(Sometimes credited as 1494 F8DD 6379 4CD7 E7E3 1FC9 D750 4243 1F05 9424.)

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] SQL transaction uncommited?

2005-12-17 Thread Andreas Jung



 Forwarded Message 
Date: 17. Dezember 2005 13:31:23 +0100
From: Vlada Macek <[EMAIL PROTECTED]>
To: zope@zope.org
Subject: [Zope] SQL transaction uncommited?

Hi,

in ZopeBook I read that Zope's transaction are tied to SQL backend's
ones. I do not know whether this applies to ZSQL methods only, but I
do not expect it. I got this table:

Dealing with transaction is the task of the database adapter and not the
ZSQL methods. If you need to deal with transactions yourself you must 
subclass the transaction manager TM and implement the hooks for commit

and abort (see TM.py).

-aj





pgpnBYS5rqhbu.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] SQL transaction uncommited?

2005-12-17 Thread Vlada Macek
Hi,

in ZopeBook I read that Zope's transaction are tied to SQL backend's
ones. I do not know whether this applies to ZSQL methods only, but I
do not expect it. I got this table:

CREATE TABLE testtable
(
  id serial,  -- uses its own sequence
  n int4
);

I use PostgreSQL and I have psql (an interactive SQL processor) opened
and I'm watching the testtable and its primary key sequence object.
I'm writing a product tool and I test the SQL connection with the
following code:

def manage_afterAdd(self, item, container):
if item is self:
self.db = getattr(self,MY_CONNECTION_ID)._v_database_connection

def qry(self, query): 
results = self.db.query(query)
recs = {
'names': Results(results).names(),
'tuples': Results(results).tuples()
}
return recs

def test0(self):
self.qry('insert into testtable (n) values (10)')

def test1(self):
self.qry('insert into testtable (n) values (10)')
self.db.commit()

def test2(self):
self.qry('insert into testtable (n) values (10)')
self.qry('commit')

def test3(self):
self.qry('insert into testtable (n) values (10)')
return self.qry('select * from testtable')

def test4(self):
self.qry('insert into testtable (n) values (10); commit')

def test5(self):
self.qry('insert into testtable (n) values (10); commit')
return self.qry('select * from testtable')

When I call test0,1,2,3 -- the inserted row is not visible in psql,
but the sequence is incremented! I'm afraid there is some pending
transaction I cannot reach at that moment anymore.

The test4,5 properly add the row to table (and increment the seq of
course) as I can watch via psql immediatelly.

In test3 the returned result does not contain the new row, in test5
the new row is contained in select.

What am I doing wrong and how must I arrange it not need to care about
transactions at all? I expected the SQL transactions are transparent
in Zope and they are either commited when the webbrowser gets the
no-exception response and rolled back otherwise.

Thanks in advance!

-- 

\//\/\
(Sometimes credited as 1494 F8DD 6379 4CD7 E7E3 1FC9 D750 4243 1F05 9424.)

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] sql access style

2005-11-04 Thread J Cameron Cooper

Vlada Macek wrote:

I'm about to create a Zope (Plone, in fact) application, as a Package,
that will operate on data accessible via SQL (Firebird RDBMS). I'm
ordered the data must stay in SQL storage, not in ZODB.

Recently I found, outside of Zope, that using python-kinterbasdb module
is very straighforward and easy. It's simply about writing SQL
statements to Python code. Until then I thought I'll use usual ZSQL
Methods for each SQL statement in the application, but kinterbasdb seems
to allow a quickier developing.

First thing that arises is that I will need to keep the persistent
connection reference in the product instance, but it's bearable IMHO.

I'm unexperienced in this, please may I hear pros/cons of each method?


You might look at "ExtZSQL":http://www.zope.org/Members/jccooper/extzsql

It is made for using RDBMS in Zope products.

--jcc
--
"Building Websites with Plone"
http://plonebook.packtpub.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] sql access style

2005-11-04 Thread Vlada Macek

I'm about to create a Zope (Plone, in fact) application, as a Package,
that will operate on data accessible via SQL (Firebird RDBMS). I'm
ordered the data must stay in SQL storage, not in ZODB.

Recently I found, outside of Zope, that using python-kinterbasdb module
is very straighforward and easy. It's simply about writing SQL
statements to Python code. Until then I thought I'll use usual ZSQL
Methods for each SQL statement in the application, but kinterbasdb seems
to allow a quickier developing.

First thing that arises is that I will need to keep the persistent
connection reference in the product instance, but it's bearable IMHO.

I'm unexperienced in this, please may I hear pros/cons of each method?
Thanks in advance.

-- 

\//\/\
(Sometimes credited as 1494 F8DD 6379 4CD7 E7E3 1FC9 D750 4243 1F05 9424.)


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] SQL query in ZSQLMethod

2005-09-25 Thread Peter Bengtsson
Plus, celtek, when you use DTML in ZSQL methods use this:
 to automatically quote strings.
Otherwise you'd have to do this:
''
which might not work anyway.

2005/9/25, David H <[EMAIL PROTECTED]>:
>  How do you want to change this notation? What is it you want to do?  Please
> spend as much time writing a question as someone may in answering it!
>
>  You do not want logic in your zsql methods.
>  I tend to use python scripts for branching logic, eg
>
>  # python script
>  request = context.REQUEST
>  if request.get('value1') == someValue:
> do the add zsql
>  else:
>do the edit zsql.
>
>
>
>  [EMAIL PROTECTED] wrote:
>
> Hi,
> In ZSQLMethod I would have SQL query similar to this logic:
>
> IF
> value1= and value2=
> THEN
> update table set(
> name=''
> )where value1= and value2=
> ELSE
> insert into table values(
> Id,
>
> name='',
> value1=,
> value2=
> )
> I can't figure out how to change this notation.
>
> Many greetings and thanks for every answer!
>
>
>
>
> ___
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
>
>
>


--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] SQL query in ZSQLMethod

2005-09-24 Thread David H




How do you want to change this notation? What is it you want to do? 
Please spend as much time writing a question as someone may in
answering it!

You do not want logic in your zsql methods.
I tend to use python scripts for branching logic, eg

# python script
request = context.REQUEST
if request.get('value1') == someValue:
   do the add zsql
else:
  do the edit zsql.


[EMAIL PROTECTED] wrote:

  
  
  
  Hi, 
  In ZSQLMethod I would have SQL
query similar to this logic:
   
  IF
  value1= and
value2=
  THEN
  update table set(
  name=''
  )where value1=
and value2=
  ELSE
  insert into table values(
  Id,
  
  name='',
  
  value1=, 
  value2=
  )
  I can't figure out how to change
this notation.
   
  Many greetings and thanks for every
answer!  
 
  
  




___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] SQL query in ZSQLMethod

2005-09-24 Thread celtek



Hi, 
In ZSQLMethod I would have SQL 
query similar to this logic:
 
IF
value1= and 
value2=
THEN
update table set(
name=''
)where value1= and value2=
ELSE
insert into table values(
Id,

name='',
value1=, 
value2=
)
I can't figure out how to change this 
notation.
 
Many greetings and thanks for every 
answer!   
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Sql statement in dtml code

2005-09-09 Thread Peter Bengtsson
Try to locate what causes this error by commenting things out one by
one. Eventually you'll be able to locate the culprit which someone on
the list might be able to help you with.

On 9/9/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Ok, I've made a few changes, and now I get this error:
> 
> Site Error
> An error was encountered while publishing this resource.
> 
> AttributeError
> 
> Sorry, a site error occurred.
> 
> Traceback (innermost last):
> 
>   * Module ZPublisher.Publish, line 175, in publish_module_standard
>   * Module Products.PlacelessTranslationService.PatchStringIO, line
> 51, in new_publish
>   * Module ZPublisher.Publish, line 132, in publish
>   * Module Zope.App.startup, line 204, in zpublisher_exception_hook
>   * Module ZPublisher.Publish, line 101, in publish
>   * Module ZPublisher.mapply, line 88, in mapply
>   * Module ZPublisher.Publish, line 39, in call_object
>   * Module Products.CMFCore.FSDTMLMethod, line 141, in __call__
>   * Module DocumentTemplate.DT_String, line 474, in __call__
>   * Module Products.CMFCore.FSDTMLMethod, line 134, in __call__
>   * Module DocumentTemplate.DT_String, line 474, in __call__
>   * Module DocumentTemplate.DT_In, line 676, in renderwob
>   * Module AccessControl.ImplPython, line 164, in guarded_getitem
>   * Module AccessControl.ZopeGuards, line 67, in guarded_getitem
> AttributeError: __getitem__
> 
> 
> On Fri, 2005-09-09 at 11:55 +0100, Peter Bengtsson wrote:
> > Like Joe said, have you confused the critical difference between
> > "sql_select_counts" and "sql_select_counts.zsql"
> >
> >
> > On 9/9/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > > Hi,
> > > I've attached the two files that I'm using
> > > Full error is this:
> > >
> > > Site Error
> > > An error was encountered while
> > > publishing this resource.
> > >
> > > KeyError
> > >
> > > Sorry, a site error occurred.
> > >
> > > Traceback (innermost last):
> > >
> > >   * Module ZPublisher.Publish,
> > > line 175, in
> > > publish_module_standard
> > >   * Module
> > > Products.PlacelessTranslationService.PatchStringIO, line 51, in 
> > > new_publish
> > >   * Module ZPublisher.Publish,
> > > line 132, in publish
> > >   * Module Zope.App.startup,
> > > line 204, in
> > > zpublisher_exception_hook
> > >   * Module ZPublisher.Publish,
> > > line 101, in publish
> > >   * Module ZPublisher.mapply,
> > > line 88, in mapply
> > >   * Module ZPublisher.Publish,
> > > line 39, in call_object
> > >   * Module
> > > Products.CMFCore.FSDTMLMethod, line 141, in __call__
> > >   * Module
> > > DocumentTemplate.DT_String,
> > > line 474, in __call__
> > >   * Module
> > > Products.CMFCore.FSDTMLMethod, line 134, in __call__
> > >   * Module
> > > DocumentTemplate.DT_String,
> > > line 474, in __call__
> > >   * Module
> > > DocumentTemplate.DT_In, line
> > > 623, in renderwob
> > > KeyError: 'sql_select_counts'
> > >
> > >
> > > 
> > >
> > > Troubleshooting Suggestions
> > >
> > >   * The URL may be incorrect.
> > >   * The parameters passed to
> > > this resource may be
> > > incorrect.
> > >   * A resource that this
> > > resource relies on may be
> > > encountering an error.
> > >
> > > For more detailed information about
> > > the error, please refer to error
> > > log.
> > >
> > > If the error persists please contact
> > > the site maintainer. Thank you for
> > > your patience.
> > >
> > >
> > >
> > > On Fri, 2005-09-09 at 11:48 +0100, Peter Bengtsson wrote:
> > > > And this doesn't work when you refresh?? I find that hard to believe.
> > > > What's the error (including traceback)
> > > >
> > > > On 9/9/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > > > > sorry, i meant when i run the code - i'm not with zope terminology 
> > > > > yet.
> > > > > here's my date_count.zsql method:
> > > > > select count(*) AS endcount from t_transaction
> > > > >
> > > > > and in the dtml, i've got:
> > > > > 
> > > > > 
> > > > > 
> > > > >
> > > > > Thanks for the replies so far!
> > > > > Paul
> > > > >
> > > > > On Fri, 2005-09-09 at 11:30 +0100, Peter Bengtsson wrote:
> > > > > > When the page is refreshed??? It shouldn't matter. It's got to be
> > > > > > something wrong with the SQL statement.
> > > > > >
> > > > > > A ZSQL method doesn't really have "an output", you have to loop over
> > > > > > it and get the "output" for each key in the iterations.
> > > > > >
> > > > > > On 9/9/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > > > > > > Hi Joe,
> > > > > > > thanks for the quick reply!
> > > > > > > i've got a zsql method now(called date_count.zsql) which I try to 
> > > > > > > call
> > > > > > > in my dtml via  - but I get 

Re: [Zope] Sql statement in dtml code

2005-09-09 Thread paul . hendrick
Ok, I've made a few changes, and now I get this error: 

Site Error
An error was encountered while publishing this resource. 

AttributeError

Sorry, a site error occurred.

Traceback (innermost last):

  * Module ZPublisher.Publish, line 175, in publish_module_standard
  * Module Products.PlacelessTranslationService.PatchStringIO, line
51, in new_publish
  * Module ZPublisher.Publish, line 132, in publish
  * Module Zope.App.startup, line 204, in zpublisher_exception_hook
  * Module ZPublisher.Publish, line 101, in publish
  * Module ZPublisher.mapply, line 88, in mapply
  * Module ZPublisher.Publish, line 39, in call_object
  * Module Products.CMFCore.FSDTMLMethod, line 141, in __call__
  * Module DocumentTemplate.DT_String, line 474, in __call__
  * Module Products.CMFCore.FSDTMLMethod, line 134, in __call__
  * Module DocumentTemplate.DT_String, line 474, in __call__
  * Module DocumentTemplate.DT_In, line 676, in renderwob
  * Module AccessControl.ImplPython, line 164, in guarded_getitem
  * Module AccessControl.ZopeGuards, line 67, in guarded_getitem
AttributeError: __getitem__


On Fri, 2005-09-09 at 11:55 +0100, Peter Bengtsson wrote:
> Like Joe said, have you confused the critical difference between
> "sql_select_counts" and "sql_select_counts.zsql"
> 
> 
> On 9/9/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > Hi,
> > I've attached the two files that I'm using
> > Full error is this:
> > 
> > Site Error
> > An error was encountered while
> > publishing this resource.
> > 
> > KeyError
> > 
> > Sorry, a site error occurred.
> > 
> > Traceback (innermost last):
> > 
> >   * Module ZPublisher.Publish,
> > line 175, in
> > publish_module_standard
> >   * Module
> > Products.PlacelessTranslationService.PatchStringIO, line 51, in 
> > new_publish
> >   * Module ZPublisher.Publish,
> > line 132, in publish
> >   * Module Zope.App.startup,
> > line 204, in
> > zpublisher_exception_hook
> >   * Module ZPublisher.Publish,
> > line 101, in publish
> >   * Module ZPublisher.mapply,
> > line 88, in mapply
> >   * Module ZPublisher.Publish,
> > line 39, in call_object
> >   * Module
> > Products.CMFCore.FSDTMLMethod, line 141, in __call__
> >   * Module
> > DocumentTemplate.DT_String,
> > line 474, in __call__
> >   * Module
> > Products.CMFCore.FSDTMLMethod, line 134, in __call__
> >   * Module
> > DocumentTemplate.DT_String,
> > line 474, in __call__
> >   * Module
> > DocumentTemplate.DT_In, line
> > 623, in renderwob
> > KeyError: 'sql_select_counts'
> > 
> > 
> > 
> > 
> > Troubleshooting Suggestions
> > 
> >   * The URL may be incorrect.
> >   * The parameters passed to
> > this resource may be
> > incorrect.
> >   * A resource that this
> > resource relies on may be
> > encountering an error.
> > 
> > For more detailed information about
> > the error, please refer to error
> > log.
> > 
> > If the error persists please contact
> > the site maintainer. Thank you for
> > your patience.
> > 
> > 
> > 
> > On Fri, 2005-09-09 at 11:48 +0100, Peter Bengtsson wrote:
> > > And this doesn't work when you refresh?? I find that hard to believe.
> > > What's the error (including traceback)
> > >
> > > On 9/9/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > > > sorry, i meant when i run the code - i'm not with zope terminology yet.
> > > > here's my date_count.zsql method:
> > > > select count(*) AS endcount from t_transaction
> > > >
> > > > and in the dtml, i've got:
> > > > 
> > > > 
> > > > 
> > > >
> > > > Thanks for the replies so far!
> > > > Paul
> > > >
> > > > On Fri, 2005-09-09 at 11:30 +0100, Peter Bengtsson wrote:
> > > > > When the page is refreshed??? It shouldn't matter. It's got to be
> > > > > something wrong with the SQL statement.
> > > > >
> > > > > A ZSQL method doesn't really have "an output", you have to loop over
> > > > > it and get the "output" for each key in the iterations.
> > > > >
> > > > > On 9/9/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > > > > > Hi Joe,
> > > > > > thanks for the quick reply!
> > > > > > i've got a zsql method now(called date_count.zsql) which I try to 
> > > > > > call
> > > > > > in my dtml via  - but I get a KeyError when the 
> > > > > > page
> > > > > > is refreshed. The dtml is in the same dir as the zsql...not sure 
> > > > > > whats
> > > > > > up.
> > > > > >
> > > > > > Cheers,
> > > > > > Paul
> > > > > >
> > > > > > On Fri, 2005-09-09 at 11:06 +0100, Joe Bezier wrote:
> > > > > > > I'm not sure if this is what you're looking for
> > > > > > >
> > > > > > >  > > > > > > expr="sql_statement(parameter1=parameter1,parameter2=parameter2)">
> > > > > > > 
> > > > > > > 
> > > > > > >
> > > > 

Re: [Zope] Sql statement in dtml code

2005-09-09 Thread Peter Bengtsson
Like Joe said, have you confused the critical difference between
"sql_select_counts" and "sql_select_counts.zsql"


On 9/9/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hi,
> I've attached the two files that I'm using
> Full error is this:
> 
> Site Error
> An error was encountered while
> publishing this resource.
> 
> KeyError
> 
> Sorry, a site error occurred.
> 
> Traceback (innermost last):
> 
>   * Module ZPublisher.Publish,
> line 175, in
> publish_module_standard
>   * Module
> Products.PlacelessTranslationService.PatchStringIO, line 51, in 
> new_publish
>   * Module ZPublisher.Publish,
> line 132, in publish
>   * Module Zope.App.startup,
> line 204, in
> zpublisher_exception_hook
>   * Module ZPublisher.Publish,
> line 101, in publish
>   * Module ZPublisher.mapply,
> line 88, in mapply
>   * Module ZPublisher.Publish,
> line 39, in call_object
>   * Module
> Products.CMFCore.FSDTMLMethod, line 141, in __call__
>   * Module
> DocumentTemplate.DT_String,
> line 474, in __call__
>   * Module
> Products.CMFCore.FSDTMLMethod, line 134, in __call__
>   * Module
> DocumentTemplate.DT_String,
> line 474, in __call__
>   * Module
> DocumentTemplate.DT_In, line
> 623, in renderwob
> KeyError: 'sql_select_counts'
> 
> 
> 
> 
> Troubleshooting Suggestions
> 
>   * The URL may be incorrect.
>   * The parameters passed to
> this resource may be
> incorrect.
>   * A resource that this
> resource relies on may be
> encountering an error.
> 
> For more detailed information about
> the error, please refer to error
> log.
> 
> If the error persists please contact
> the site maintainer. Thank you for
> your patience.
> 
> 
> 
> On Fri, 2005-09-09 at 11:48 +0100, Peter Bengtsson wrote:
> > And this doesn't work when you refresh?? I find that hard to believe.
> > What's the error (including traceback)
> >
> > On 9/9/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > > sorry, i meant when i run the code - i'm not with zope terminology yet.
> > > here's my date_count.zsql method:
> > > select count(*) AS endcount from t_transaction
> > >
> > > and in the dtml, i've got:
> > > 
> > > 
> > > 
> > >
> > > Thanks for the replies so far!
> > > Paul
> > >
> > > On Fri, 2005-09-09 at 11:30 +0100, Peter Bengtsson wrote:
> > > > When the page is refreshed??? It shouldn't matter. It's got to be
> > > > something wrong with the SQL statement.
> > > >
> > > > A ZSQL method doesn't really have "an output", you have to loop over
> > > > it and get the "output" for each key in the iterations.
> > > >
> > > > On 9/9/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > > > > Hi Joe,
> > > > > thanks for the quick reply!
> > > > > i've got a zsql method now(called date_count.zsql) which I try to call
> > > > > in my dtml via  - but I get a KeyError when the 
> > > > > page
> > > > > is refreshed. The dtml is in the same dir as the zsql...not sure whats
> > > > > up.
> > > > >
> > > > > Cheers,
> > > > > Paul
> > > > >
> > > > > On Fri, 2005-09-09 at 11:06 +0100, Joe Bezier wrote:
> > > > > > I'm not sure if this is what you're looking for
> > > > > >
> > > > > >  > > > > > expr="sql_statement(parameter1=parameter1,parameter2=parameter2)">
> > > > > > 
> > > > > > 
> > > > > >
> > > > > > If no parameters, just expr="sql_statement()" or  > > > > > sql_statement>
> > > > > >
> > > > > > Cheers,
> > > > > >
> > > > > > JB
> > > > > >
> > > > > >
> > > > > > On 9 Sep 2005, at 10:50, [EMAIL PROTECTED] wrote:
> > > > > >
> > > > > > > Hi all,
> > > > > > > I'm trying to basically get the output of two SELECT statements 
> > > > > > > into a
> > > > > > > dtml document, but cant get it working.
> > > > > > > I've searched, and tried a few examples for similar things, but 
> > > > > > > had no
> > > > > > > luck. Can anyone recommend a way, please?
> > > > > > >
> > > > > > > Thanks,
> > > > > > > Paul
> > > > > > >
> > > > > > > ___
> > > > > > > Zope maillist  -  Zope@zope.org
> > > > > > > http://mail.zope.org/mailman/listinfo/zope
> > > > > > > **   No cross posts or HTML encoding!  **
> > > > > > > (Related lists -
> > > > > > >  http://mail.zope.org/mailman/listinfo/zope-announce
> > > > > > >  http://mail.zope.org/mailman/listinfo/zope-dev )
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > ___
> > > > > > Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide 
> > > > > > with voicemail http://uk.messenger.yahoo.com
> > > > > >
> > > > >
> > > > > ___
> > > > > Zope maillist  -  Zope@zope.org
> > > > > http://mail.zope.org/mailman/listinfo/zope
> > > > > **

Re: [Zope] Sql statement in dtml code

2005-09-09 Thread paul . hendrick
Hi,
I've attached the two files that I'm using
Full error is this: 
  
Site Error
An error was encountered while
publishing this resource. 

KeyError

Sorry, a site error occurred.

Traceback (innermost last):

  * Module ZPublisher.Publish,
line 175, in
publish_module_standard
  * Module
Products.PlacelessTranslationService.PatchStringIO, line 51, in 
new_publish
  * Module ZPublisher.Publish,
line 132, in publish
  * Module Zope.App.startup,
line 204, in
zpublisher_exception_hook
  * Module ZPublisher.Publish,
line 101, in publish
  * Module ZPublisher.mapply,
line 88, in mapply
  * Module ZPublisher.Publish,
line 39, in call_object
  * Module
Products.CMFCore.FSDTMLMethod, line 141, in __call__
  * Module
DocumentTemplate.DT_String,
line 474, in __call__
  * Module
Products.CMFCore.FSDTMLMethod, line 134, in __call__
  * Module
DocumentTemplate.DT_String,
line 474, in __call__
  * Module
DocumentTemplate.DT_In, line
623, in renderwob
KeyError: 'sql_select_counts' 




Troubleshooting Suggestions

  * The URL may be incorrect.
  * The parameters passed to
this resource may be
incorrect.
  * A resource that this
resource relies on may be
encountering an error.

For more detailed information about
the error, please refer to error
log. 

If the error persists please contact
the site maintainer. Thank you for
your patience. 



On Fri, 2005-09-09 at 11:48 +0100, Peter Bengtsson wrote:
> And this doesn't work when you refresh?? I find that hard to believe.
> What's the error (including traceback)
> 
> On 9/9/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > sorry, i meant when i run the code - i'm not with zope terminology yet.
> > here's my date_count.zsql method:
> > select count(*) AS endcount from t_transaction
> > 
> > and in the dtml, i've got:
> > 
> > 
> > 
> > 
> > Thanks for the replies so far!
> > Paul
> > 
> > On Fri, 2005-09-09 at 11:30 +0100, Peter Bengtsson wrote:
> > > When the page is refreshed??? It shouldn't matter. It's got to be
> > > something wrong with the SQL statement.
> > >
> > > A ZSQL method doesn't really have "an output", you have to loop over
> > > it and get the "output" for each key in the iterations.
> > >
> > > On 9/9/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > > > Hi Joe,
> > > > thanks for the quick reply!
> > > > i've got a zsql method now(called date_count.zsql) which I try to call
> > > > in my dtml via  - but I get a KeyError when the page
> > > > is refreshed. The dtml is in the same dir as the zsql...not sure whats
> > > > up.
> > > >
> > > > Cheers,
> > > > Paul
> > > >
> > > > On Fri, 2005-09-09 at 11:06 +0100, Joe Bezier wrote:
> > > > > I'm not sure if this is what you're looking for
> > > > >
> > > > >  > > > > expr="sql_statement(parameter1=parameter1,parameter2=parameter2)">
> > > > > 
> > > > > 
> > > > >
> > > > > If no parameters, just expr="sql_statement()" or  > > > > sql_statement>
> > > > >
> > > > > Cheers,
> > > > >
> > > > > JB
> > > > >
> > > > >
> > > > > On 9 Sep 2005, at 10:50, [EMAIL PROTECTED] wrote:
> > > > >
> > > > > > Hi all,
> > > > > > I'm trying to basically get the output of two SELECT statements 
> > > > > > into a
> > > > > > dtml document, but cant get it working.
> > > > > > I've searched, and tried a few examples for similar things, but had 
> > > > > > no
> > > > > > luck. Can anyone recommend a way, please?
> > > > > >
> > > > > > Thanks,
> > > > > > Paul
> > > > > >
> > > > > > ___
> > > > > > Zope maillist  -  Zope@zope.org
> > > > > > http://mail.zope.org/mailman/listinfo/zope
> > > > > > **   No cross posts or HTML encoding!  **
> > > > > > (Related lists -
> > > > > >  http://mail.zope.org/mailman/listinfo/zope-announce
> > > > > >  http://mail.zope.org/mailman/listinfo/zope-dev )
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > ___
> > > > > Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with 
> > > > > voicemail http://uk.messenger.yahoo.com
> > > > >
> > > >
> > > > ___
> > > > Zope maillist  -  Zope@zope.org
> > > > http://mail.zope.org/mailman/listinfo/zope
> > > > **   No cross posts or HTML encoding!  **
> > > > (Related lists -
> > > >  http://mail.zope.org/mailman/listinfo/zope-announce
> > > >  http://mail.zope.org/mailman/listinfo/zope-dev )
> > > >
> > >
> > >
> > 
> > 
> 
> 
SELECT COUNT(*) AS tcount FROM t_transaction 

Despite the name of this form (it's usually used to provide a 
form wrapper around a selection screen) I am using this here
to provide a title to the page. 








Transactions for  

Re: [Zope] Sql statement in dtml code

2005-09-09 Thread Joe Bezier
OK, are you using a Zope with an error_log? [you'll see it in the root 
of your installation]. If so, could you pass on the whole traceback for 
this error?


Hang on - are you calling 'date_count' when your object's called 
'date_count.zsql'? Rename your zsql method 'date_count' and then try - 
I think that should do it. If not, send us the traceback...


Cheers

JB
On 9 Sep 2005, at 11:33, [EMAIL PROTECTED] wrote:


sorry, i meant when i run the code - i'm not with zope terminology yet.
here's my date_count.zsql method:
select count(*) AS endcount from t_transaction

and in the dtml, i've got:




Thanks for the replies so far!
Paul

On Fri, 2005-09-09 at 11:30 +0100, Peter Bengtsson wrote:

When the page is refreshed??? It shouldn't matter. It's got to be
something wrong with the SQL statement.

A ZSQL method doesn't really have "an output", you have to loop over
it and get the "output" for each key in the iterations.

On 9/9/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

Hi Joe,
thanks for the quick reply!
i've got a zsql method now(called date_count.zsql) which I try to 
call
in my dtml via  - but I get a KeyError when the 
page
is refreshed. The dtml is in the same dir as the zsql...not sure 
whats

up.

Cheers,
Paul

On Fri, 2005-09-09 at 11:06 +0100, Joe Bezier wrote:

I'm not sure if this is what you're looking for





If no parameters, just expr="sql_statement()" or sql_statement>


Cheers,

JB


On 9 Sep 2005, at 10:50, [EMAIL PROTECTED] wrote:


Hi all,
I'm trying to basically get the output of two SELECT statements 
into a

dtml document, but cant get it working.
I've searched, and tried a few examples for similar things, but 
had no

luck. Can anyone recommend a way, please?

Thanks,
Paul

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )







___
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide 
with voicemail http://uk.messenger.yahoo.com




___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )












___ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Sql statement in dtml code

2005-09-09 Thread Peter Bengtsson
And this doesn't work when you refresh?? I find that hard to believe.
What's the error (including traceback)

On 9/9/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> sorry, i meant when i run the code - i'm not with zope terminology yet.
> here's my date_count.zsql method:
> select count(*) AS endcount from t_transaction
> 
> and in the dtml, i've got:
> 
> 
> 
> 
> Thanks for the replies so far!
> Paul
> 
> On Fri, 2005-09-09 at 11:30 +0100, Peter Bengtsson wrote:
> > When the page is refreshed??? It shouldn't matter. It's got to be
> > something wrong with the SQL statement.
> >
> > A ZSQL method doesn't really have "an output", you have to loop over
> > it and get the "output" for each key in the iterations.
> >
> > On 9/9/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > > Hi Joe,
> > > thanks for the quick reply!
> > > i've got a zsql method now(called date_count.zsql) which I try to call
> > > in my dtml via  - but I get a KeyError when the page
> > > is refreshed. The dtml is in the same dir as the zsql...not sure whats
> > > up.
> > >
> > > Cheers,
> > > Paul
> > >
> > > On Fri, 2005-09-09 at 11:06 +0100, Joe Bezier wrote:
> > > > I'm not sure if this is what you're looking for
> > > >
> > > >  > > > expr="sql_statement(parameter1=parameter1,parameter2=parameter2)">
> > > > 
> > > > 
> > > >
> > > > If no parameters, just expr="sql_statement()" or 
> > > >
> > > > Cheers,
> > > >
> > > > JB
> > > >
> > > >
> > > > On 9 Sep 2005, at 10:50, [EMAIL PROTECTED] wrote:
> > > >
> > > > > Hi all,
> > > > > I'm trying to basically get the output of two SELECT statements into a
> > > > > dtml document, but cant get it working.
> > > > > I've searched, and tried a few examples for similar things, but had no
> > > > > luck. Can anyone recommend a way, please?
> > > > >
> > > > > Thanks,
> > > > > Paul
> > > > >
> > > > > ___
> > > > > Zope maillist  -  Zope@zope.org
> > > > > http://mail.zope.org/mailman/listinfo/zope
> > > > > **   No cross posts or HTML encoding!  **
> > > > > (Related lists -
> > > > >  http://mail.zope.org/mailman/listinfo/zope-announce
> > > > >  http://mail.zope.org/mailman/listinfo/zope-dev )
> > > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > ___
> > > > Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with 
> > > > voicemail http://uk.messenger.yahoo.com
> > > >
> > >
> > > ___
> > > Zope maillist  -  Zope@zope.org
> > > http://mail.zope.org/mailman/listinfo/zope
> > > **   No cross posts or HTML encoding!  **
> > > (Related lists -
> > >  http://mail.zope.org/mailman/listinfo/zope-announce
> > >  http://mail.zope.org/mailman/listinfo/zope-dev )
> > >
> >
> >
> 
> 


-- 
Peter Bengtsson, 
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Sql statement in dtml code

2005-09-09 Thread paul . hendrick
sorry, i meant when i run the code - i'm not with zope terminology yet.
here's my date_count.zsql method:
select count(*) AS endcount from t_transaction

and in the dtml, i've got:




Thanks for the replies so far!
Paul

On Fri, 2005-09-09 at 11:30 +0100, Peter Bengtsson wrote:
> When the page is refreshed??? It shouldn't matter. It's got to be
> something wrong with the SQL statement.
> 
> A ZSQL method doesn't really have "an output", you have to loop over
> it and get the "output" for each key in the iterations.
> 
> On 9/9/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > Hi Joe,
> > thanks for the quick reply!
> > i've got a zsql method now(called date_count.zsql) which I try to call
> > in my dtml via  - but I get a KeyError when the page
> > is refreshed. The dtml is in the same dir as the zsql...not sure whats
> > up.
> > 
> > Cheers,
> > Paul
> > 
> > On Fri, 2005-09-09 at 11:06 +0100, Joe Bezier wrote:
> > > I'm not sure if this is what you're looking for
> > >
> > >  > > expr="sql_statement(parameter1=parameter1,parameter2=parameter2)">
> > > 
> > > 
> > >
> > > If no parameters, just expr="sql_statement()" or 
> > >
> > > Cheers,
> > >
> > > JB
> > >
> > >
> > > On 9 Sep 2005, at 10:50, [EMAIL PROTECTED] wrote:
> > >
> > > > Hi all,
> > > > I'm trying to basically get the output of two SELECT statements into a
> > > > dtml document, but cant get it working.
> > > > I've searched, and tried a few examples for similar things, but had no
> > > > luck. Can anyone recommend a way, please?
> > > >
> > > > Thanks,
> > > > Paul
> > > >
> > > > ___
> > > > Zope maillist  -  Zope@zope.org
> > > > http://mail.zope.org/mailman/listinfo/zope
> > > > **   No cross posts or HTML encoding!  **
> > > > (Related lists -
> > > >  http://mail.zope.org/mailman/listinfo/zope-announce
> > > >  http://mail.zope.org/mailman/listinfo/zope-dev )
> > > >
> > >
> > >
> > >
> > >
> > >
> > > ___
> > > Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with 
> > > voicemail http://uk.messenger.yahoo.com
> > >
> > 
> > ___
> > Zope maillist  -  Zope@zope.org
> > http://mail.zope.org/mailman/listinfo/zope
> > **   No cross posts or HTML encoding!  **
> > (Related lists -
> >  http://mail.zope.org/mailman/listinfo/zope-announce
> >  http://mail.zope.org/mailman/listinfo/zope-dev )
> > 
> 
> 

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Sql statement in dtml code

2005-09-09 Thread Peter Bengtsson
When the page is refreshed??? It shouldn't matter. It's got to be
something wrong with the SQL statement.

A ZSQL method doesn't really have "an output", you have to loop over
it and get the "output" for each key in the iterations.

On 9/9/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hi Joe,
> thanks for the quick reply!
> i've got a zsql method now(called date_count.zsql) which I try to call
> in my dtml via  - but I get a KeyError when the page
> is refreshed. The dtml is in the same dir as the zsql...not sure whats
> up.
> 
> Cheers,
> Paul
> 
> On Fri, 2005-09-09 at 11:06 +0100, Joe Bezier wrote:
> > I'm not sure if this is what you're looking for
> >
> >  > expr="sql_statement(parameter1=parameter1,parameter2=parameter2)">
> > 
> > 
> >
> > If no parameters, just expr="sql_statement()" or 
> >
> > Cheers,
> >
> > JB
> >
> >
> > On 9 Sep 2005, at 10:50, [EMAIL PROTECTED] wrote:
> >
> > > Hi all,
> > > I'm trying to basically get the output of two SELECT statements into a
> > > dtml document, but cant get it working.
> > > I've searched, and tried a few examples for similar things, but had no
> > > luck. Can anyone recommend a way, please?
> > >
> > > Thanks,
> > > Paul
> > >
> > > ___
> > > Zope maillist  -  Zope@zope.org
> > > http://mail.zope.org/mailman/listinfo/zope
> > > **   No cross posts or HTML encoding!  **
> > > (Related lists -
> > >  http://mail.zope.org/mailman/listinfo/zope-announce
> > >  http://mail.zope.org/mailman/listinfo/zope-dev )
> > >
> >
> >
> >
> >
> >
> > ___
> > Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with 
> > voicemail http://uk.messenger.yahoo.com
> >
> 
> ___
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
> 


-- 
Peter Bengtsson, 
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Sql statement in dtml code

2005-09-09 Thread paul . hendrick
Hi Joe, 
thanks for the quick reply!
i've got a zsql method now(called date_count.zsql) which I try to call
in my dtml via  - but I get a KeyError when the page
is refreshed. The dtml is in the same dir as the zsql...not sure whats
up.

Cheers,
Paul

On Fri, 2005-09-09 at 11:06 +0100, Joe Bezier wrote:
> I'm not sure if this is what you're looking for
> 
>  expr="sql_statement(parameter1=parameter1,parameter2=parameter2)">
> 
> 
> 
> If no parameters, just expr="sql_statement()" or 
> 
> Cheers,
> 
> JB
> 
> 
> On 9 Sep 2005, at 10:50, [EMAIL PROTECTED] wrote:
> 
> > Hi all,
> > I'm trying to basically get the output of two SELECT statements into a
> > dtml document, but cant get it working.
> > I've searched, and tried a few examples for similar things, but had no
> > luck. Can anyone recommend a way, please?
> >
> > Thanks,
> > Paul
> >
> > ___
> > Zope maillist  -  Zope@zope.org
> > http://mail.zope.org/mailman/listinfo/zope
> > **   No cross posts or HTML encoding!  **
> > (Related lists -
> >  http://mail.zope.org/mailman/listinfo/zope-announce
> >  http://mail.zope.org/mailman/listinfo/zope-dev )
> >
> 
> 
>   
>   
>   
> ___ 
> Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with 
> voicemail http://uk.messenger.yahoo.com
> 

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Sql statement in dtml code

2005-09-09 Thread Joe Bezier

I'm not sure if this is what you're looking for

expr="sql_statement(parameter1=parameter1,parameter2=parameter2)">




If no parameters, just expr="sql_statement()" or 

Cheers,

JB


On 9 Sep 2005, at 10:50, [EMAIL PROTECTED] wrote:


Hi all,
I'm trying to basically get the output of two SELECT statements into a
dtml document, but cant get it working.
I've searched, and tried a few examples for similar things, but had no
luck. Can anyone recommend a way, please?

Thanks,
Paul

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )







___ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Sql statement in dtml code

2005-09-09 Thread paul . hendrick
Hi all,
I'm trying to basically get the output of two SELECT statements into a
dtml document, but cant get it working.
I've searched, and tried a few examples for similar things, but had no
luck. Can anyone recommend a way, please?

Thanks,
Paul

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] SQL Problem

2005-08-26 Thread Jaroslav Lukesh
Dne čtvrtek, 25. srpna 2005 23:52 Philip Beardmore 
<[EMAIL PROTECTED]> napsal(a):
> Hi JCC,
>
> That is exactly what I was looking for - Assigning a default value works
> great!
>
> I previously tried to do this using the syntax provided by zope help:
> title:string="default value"
>
> but had no luck.


userid:string="" 
datetime:string="" 
course:string="" 
name:string="" 
core1:string="" 
core2:string="" 
core3:string="" 
core4:string="" 
core5:string=""
choice1:string="" 
choice2:string="" 
choice3:string="" 
choice4:string="" 


INSERT choices
(userid, datetime, course, name, core1, core2, core3, core4, core5,choice1, 
choice2, choice3, choice4)
VALUES
(
,
,
,
,
,
,
,
,
,
,
,
,

)   


I use default parameters in  saction without problems.

-- 

Jaroslav Lukesh
  ---
  This e-mail can not contain any viruses because I use Linux
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] SQL Problem

2005-08-25 Thread Philip Beardmore
Hi JCC,

That is exactly what I was looking for - Assigning a default value works
great!

I previously tried to do this using the syntax provided by zope help:
title:string="default value"

but had no luck.

Thanks :->
Phil

- Original Message -
From: J Cameron Cooper <[EMAIL PROTECTED]>
Date: Thursday, August 25, 2005 10:35 pm
Subject: Re: [Zope] SQL Problem

> Philip Beardmore wrote:
> > I'm having a really annoying SQL problem which I think (or hope) can
> > easily be sorted but I'm not sure how to do it.
> > 
> > I have a ZPT which is collecting data in a form - Both text boxes 
> and> checkboxes.  The form then passes the variables on to a DTML 
> Method> which does a few bits of error checking then calls an Z SQL 
> Method to
> > insert the data.
> > 
> > If all of the data is completed (i.e. each textbox and checkbox is
> > ticked) then the form inserts the data exactly as it should.  If 
> not all
> > checkboxes are ticked the page returns an error - This is due to 
> the SQL
> > Method trying to insert data which hasnt been passed to it.
> 
> You can provide default values to the parameters of your Z SQL 
> Method. 
> Alternately, I believe the DTML sqlvar tags can also be given a 
> default 
> behavior.
> 
>   --jcc
> -- 
> "Building Websites with Plone"
> http://plonebook.packtpub.com
> 
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] SQL Problem

2005-08-25 Thread J Cameron Cooper

Philip Beardmore wrote:

I'm having a really annoying SQL problem which I think (or hope) can
easily be sorted but I'm not sure how to do it.

I have a ZPT which is collecting data in a form - Both text boxes and
checkboxes.  The form then passes the variables on to a DTML Method
which does a few bits of error checking then calls an Z SQL Method to
insert the data.

If all of the data is completed (i.e. each textbox and checkbox is
ticked) then the form inserts the data exactly as it should.  If not all
checkboxes are ticked the page returns an error - This is due to the SQL
Method trying to insert data which hasnt been passed to it.


You can provide default values to the parameters of your Z SQL Method. 
Alternately, I believe the DTML sqlvar tags can also be given a default 
behavior.


--jcc
--
"Building Websites with Plone"
http://plonebook.packtpub.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] SQL Problem

2005-08-25 Thread Philip Beardmore
I'm having a really annoying SQL problem which I think (or hope) can
easily be sorted but I'm not sure how to do it.

I have a ZPT which is collecting data in a form - Both text boxes and
checkboxes.  The form then passes the variables on to a DTML Method
which does a few bits of error checking then calls an Z SQL Method to
insert the data.

If all of the data is completed (i.e. each textbox and checkbox is
ticked) then the form inserts the data exactly as it should.  If not all
checkboxes are ticked the page returns an error - This is due to the SQL
Method trying to insert data which hasnt been passed to it.

Below is my SQL Method:

INSERT choices
(userid, datetime, course, name, core1, core2, core3, core4, core5,
choice1, choice2, choice3, choice4)
VALUES
(
,
,
,
,
,
,
,
,
,
,
,
,

)

Arguments are:
userid datetime course name core1 core2 core3 core4 core5 choice1
choice2 choice3 choice4

Note: Choice1-4 are checkboxes and every other item is a textbox.

Please help - Its doing my head in!

Cheers and all the best
Phil
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] SQL query manage_test throws KeyError vith value 'query'

2005-06-07 Thread Dennis Allison
Failure occurs with 
Zope 2.7.6 final
Python 2.3.5 or Phython 2.4.1
MySQLdb 1.2.1 gamma or MySQLdb 1.1.1 final
ZMySQLDA 2.08 or ZMYSQLDA 2.09
Failure does not occur with 
Zope 2.6.4
python 2.3.5
MySQLdb 1.1.1 final
ZMySQLDA 2.08

The traceback is:

Time  2005/06/07 16:47:44.967 GMT-7
User Name (User Id) allison (allison)
Request URL http://dev.agilemind.com/draPlay/webpagetest/manage_test
Exception Type KeyError
Exception Value 'query'

Traceback (innermost last):

* Module ZPublisher.Publish, line 101, in publish
* Module ZPublisher.mapply, line 88, in mapply
* Module ZPublisher.Publish, line 39, in call_object
* Module Shared.DC.ZRDB.DA, line 337, in manage_test
* Module DocumentTemplate.DT_String, line 474, in __call__
* Module DocumentTemplate.DT_In, line 602, in renderwb
* Module DocumentTemplate.DT_Var, line 219, in render

KeyError: 'query'

Failure is highly repeatable and happens for queries of the form

select * from table

The REQUEST shows:

form
SUBMIT 'Submit Query'
cookies
tree-s 'eJzTyCkw5NLIKTDiClZ3hANXW3WuAmOuxEQ9AIOOB9Q'
__ac_name 'allison'
lazy items
SESSION >
other
n_ 5

REQUEST_METHOD'GET'
HTTP_KEEP_ALIVE'300'
SERVER_PROTOCOL'HTTP/1.1'
QUERY_STRING'SUBMIT=Submit+Query'

Somewhere between manage_testForm and manage_test something fails,
possibly as the query goes off to be rendered through the DocumentTemplate
mechanism.  Right at the moment, I'm stuck.  Advice, clues appreciated.



___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] SQL Database Connections

2005-05-20 Thread Tino Wildenhain
Am Freitag, den 20.05.2005, 18:28 +0200 schrieb Andreas Jung:
> 
> --On Freitag, 20. Mai 2005 9:18 Uhr -0700 Jonathan Daugherty 
> <[EMAIL PROTECTED]> wrote:
> 
> ># Depends on the underlaying DAso which one are you using? In
> ># general a DA should reconnect automatically.
> >
> > I'm using the zope-psycopgda 1.1.18-1 debian package, debian testing.
> >
> 
> Try to upgrade...

Well, afaic this is a problem of the upgrade ;) 
this "feature" was introduced in the recent version
of the psycopgda. 
Maybe this can be hacked...



___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] SQL Database Connections

2005-05-20 Thread Andreas Jung

--On Freitag, 20. Mai 2005 9:18 Uhr -0700 Jonathan Daugherty 
<[EMAIL PROTECTED]> wrote:

# Depends on the underlaying DAso which one are you using? In
# general a DA should reconnect automatically.
I'm using the zope-psycopgda 1.1.18-1 debian package, debian testing.
Try to upgrade...
-aj


pgpWEdvNFsUxh.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] SQL Database Connections

2005-05-20 Thread Barry Pederson
Jonathan Daugherty wrote:
> # Depends on the underlaying DAso which one are you using? In
> # general a DA should reconnect automatically.
> 
> I'm using the zope-psycopgda 1.1.18-1 debian package, debian testing.

That version of ZPsycopgDA doesn't auto-reconnect, but it looks like that
feature was added back in 1.1.19

   http://initd.org/svn/initd/psycopg1/trunk/ChangeLog


2005-01-13  Federico Di Gregorio  <[EMAIL PROTECTED]>

* ZPsycopgDA/db.py (DB.query): applied patch from Jonathan
Stoneman to automatically try to reconnect *once* on
OperationalError. This fix the problem with Zope loosing the
connection to the database when PostgreSQL is restarted.


Barry
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] SQL Database Connections

2005-05-20 Thread Jonathan Daugherty
# Depends on the underlaying DAso which one are you using? In
# general a DA should reconnect automatically.

I'm using the zope-psycopgda 1.1.18-1 debian package, debian testing.

-- 
  Jonathan Daugherty
  http://www.parsed.org
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] SQL Database Connections

2005-05-20 Thread Andreas Jung

--On Freitag, 20. Mai 2005 9:05 Uhr -0700 Jonathan Daugherty 
<[EMAIL PROTECTED]> wrote:

Greetings,
I connect to PostgreSQL from Zope and whenever I upgrade postgres on
my server, my persistent database connections in Zope fail.  I have to
log in to the ZMI and reconnect the connection objects manually to
restore the connections; is there a way to attempt a reconnection
automatically when postgres goes down or is upgraded?
Depends on the underlaying DAso which one are you using? In general
a DA should reconnect automatically.
-aj


pgpmRjFbWVs7B.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] SQL Database Connections

2005-05-20 Thread Jonathan Daugherty
Greetings,

I connect to PostgreSQL from Zope and whenever I upgrade postgres on
my server, my persistent database connections in Zope fail.  I have to
log in to the ZMI and reconnect the connection objects manually to
restore the connections; is there a way to attempt a reconnection
automatically when postgres goes down or is upgraded?

-- 
  Jonathan Daugherty
  http://www.parsed.org
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] SQL-based LoginManager and subtransactions

2001-01-26 Thread Oliver Bleutgen

> I haven't been following this discussion, but it sounds like there's
> the potential for SQL operations performed by LoginManager to
> interfere with other SQL operations such as logging uploaded files, in
> the case where the database system does not support nested (sub-)
> transactions.  Correct? 

No, but I'm really not familiar enough with the ZODB machinery and 
zope internals to tell do much more than wild guesses.
The problem seems to be that the ZODB and things like Zcatalog know
about subtransactions (you can disable them with the latter one),
but some (the most) zope db-adapters don't.
Now zope seems to use subtransactions internally and to expect the DAs 
to provide them also (commit_sub), but for now it seems to not completly
clear when and why - see the thread "subtransactions".
For file-uploads the threshold may be <~ 120kb, that is which 
bites people with loginmanager/postgres.
The workaround from I cited should at least solve the zope-error,
but I have no idea if it can hurt.
The best thing would be to properly implement the missing methods in the
DAs, I guess, unfortunately this is above my head for now.

PS: the sybase DA seems to know about commit_sub


cheers,
oliver

___
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-based LoginManager and subtransactions

2001-01-26 Thread Fred Yankowski

I haven't been following this discussion, but it sounds like there's
the potential for SQL operations performed by LoginManager to
interfere with other SQL operations such as logging uploaded files, in
the case where the database system does not support nested (sub-)
transactions.  Correct?  If so, would it help to create a separate
database access object, and therefore separate connection (I think),
just for the use of LoginManager?  Or could this cause some deadlock
between the LoginManager and other connections?  I'm quite interested
in potential problems here as I plan to use PostgreSQL with
LoginManager on my sites.

On Fri, Jan 26, 2001 at 06:23:57PM +0100, Oliver Bleutgen wrote:
> As we use Loginmanager with postgres, I have know idea how to not
> invoke Z SQL methods when upload.  Has anybody an idea if and under
> what circumstances the above snipped could do harm?

-- 
Fred Yankowski   [EMAIL PROTECTED]  tel: +1.630.879.1312
Principal Consultant www.OntoSys.com   fax: +1.630.879.1370
OntoSys, Inc 38W242 Deerpath Rd, Batavia, IL 60510, USA

___
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] SQL query result set - what data structure & how to access [(elements)]?

2001-01-21 Thread Andrew Kenneth Milton

+---[ Lee ]--
| Hi,
| 
| I'm using a python method to query my database as follows, where I need
| to use the result set to generate some HTML. I'm interested in result[0]
| and result[1] as listed below;
| 
| * return result[0] gives me:
| [{'name': 'PRACTICALS', 'type': 's', 'null': None, 'width': None},
| {'name': 'TUTORIALS', 'type': 's', 'null': None, 'width': None},
| {'name': 'ASSIGNMENTS', 'type': 's', 'null': None, 'width': None},
| {'name': 'BONUS', 'type': 's', 'null': None, 'width': None}]
| 
| * return result[1] (or just 'return result') gives me:
| [(1, 16, 9, 1)]
| 
| What kind of data structure is this? First impressions suggest that it's
| a tuple but why the extra brackets?. I need to access each element but
| how do I do this? I've tried all sort of tuple/list
| conversions/operations and have had no success.
| 
| If the result is [(1, 16, 9, 1)] how can I assign...
| 
| a=1st element i.e. 1
| b=2nd element i.e 16..?
| 

Ok try this... you're getting a ResultSet back, here's some code to
iterate over them.

These are little gems I've gleaned from various places, so I take
no credit (or responsibility) for this code :-)

add these to your .py file


from string import upper, lower
import Missing
mt=type(Missing.Value)

def typeconv(val):
if type(val)==mt:
return ''
return val

def sqlattr(ob, attr):
name=attr
if hasattr(ob, attr):
return typeconv(getattr(ob, attr))
attr=upper(attr)
if hasattr(ob, attr):
return typeconv(getattr(ob, attr))
attr=lower(attr)
if hasattr(ob, attr):
return typeconv(getattr(ob, attr))
raise NameError, name


Then as an example of how it works;
in the same .py file.

def parseResultSet(self):
userList={}
myResults=self.sqlGetAllCustomers()
for cust in myResults:
customername=sqlattr(cust,'customername')
username=sqlattr(cust,'username')
userList[username]=customername
return userList

myResults represents any result set... so it should 'just work', YMMV

-- 
Totally Holistic Enterprises Internet|  P:+61 7 3870 0066   | Andrew Milton
The Internet (Aust) Pty Ltd  |  F:+61 7 3870 4477   | 
ACN: 082 081 472 ABN: 83 082 081 472 |  M:+61 416 022 411   | Carpe Daemon
PO Box 837 Indooroopilly QLD 4068|[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] SQL query result set - what data structure & how to access [(elements)]?

2001-01-20 Thread Lee

Hi,

I'm using a python method to query my database as follows, where I need
to use the result set to generate some HTML. I'm interested in result[0]
and result[1] as listed below;

* return result[0] gives me:
[{'name': 'PRACTICALS', 'type': 's', 'null': None, 'width': None},
{'name': 'TUTORIALS', 'type': 's', 'null': None, 'width': None},
{'name': 'ASSIGNMENTS', 'type': 's', 'null': None, 'width': None},
{'name': 'BONUS', 'type': 's', 'null': None, 'width': None}]

* return result[1] (or just 'return result') gives me:
[(1, 16, 9, 1)]

What kind of data structure is this? First impressions suggest that it's
a tuple but why the extra brackets?. I need to access each element but
how do I do this? I've tried all sort of tuple/list
conversions/operations and have had no success.

If the result is [(1, 16, 9, 1)] how can I assign...

a=1st element i.e. 1
b=2nd element i.e 16..?

I can convert it to a string, parse it and obtain the results that way,
which is simple enough, but surely there's a way to access the element
directly? Does anyone know?

Thanks,

Lee




___
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] SQL delimiter?

2001-01-18 Thread Jose Soares

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 )




Re: [Zope] SQL delimiter?

2001-01-17 Thread jpenny

On Wed, Jan 17, 2001 at 04:36:29PM -0800, 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.

No indeed, any number of SQL statments may be in a ZSQL Method,
although at most one may be a SELECT.

If you know your databases convention, you can use the normal separator,
i.e. PostgreSQL supports ';' as the separator.  Just do it.  This may
cause portability problems.

 is supposed to be portable.


> 
> 
> 
> 
> ___
> 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] SQL delimiter?

2001-01-17 Thread Fred Yankowski

On Wed, Jan 17, 2001 at 04:36:29PM -0800, 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?

It's .

I just needed that yesterday, and I found it on p 28 of my printed
(from PDF) copy of the Z SQL Methods User's Guide, in the "Query
Templates" section (huh?).

-- 
Fred Yankowski   [EMAIL PROTECTED]  tel: +1.630.879.1312
Principal Consultant www.OntoSys.com   fax: +1.630.879.1370
OntoSys, Inc 38W242 Deerpath Rd, Batavia, IL 60510, USA

___
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] SQL delimiter?

2001-01-17 Thread Andy McKay

Thats it, great thanks.

(A search through the ZopeBook and Docs produces no matches)
--
  Andy McKay.


- Original Message -
From: "Curtis Maloney" <[EMAIL PROTECTED]>
To: "Andy McKay" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, January 17, 2001 4:41 PM
Subject: Re: [Zope] SQL delimiter?


> On Thursday 18 January 2001 11:36, 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.
> >
> >
>
> 
>
> Curtis.
>


___
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] SQL delimiter?

2001-01-17 Thread Curtis Maloney

On Thursday 18 January 2001 11:36, 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.
>
>



Curtis.

___
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 delimiter?

2001-01-17 Thread Andy McKay

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 )




Re: [Zope] ZOPE : SQL methods

2001-01-12 Thread Dieter Maurer

K H Subrahmanyan writes:
 >   I am using zope and gadfly for my project.
 > but while using the SQL methods, I get the error if I use the "like" option.
 > 
 > E.g..   select  *
 > from  table
 > where
 >  Emp_name   like   "*rama*"
 > 
 > I will get the following error.
Maybe, you should look at an SQL book or other SQL description...

 1. strings are surrounded by '...' not "..."
 2. the "match sequence" wildcard is "%" not "*"


Dieter

___
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] ZOPE : SQL methods

2001-01-12 Thread K H Subrahmanyan

hi,

  I am using zope and gadfly for my project.
but while using the SQL methods, I get the error if I use the "like" option.

E.g..   select  *
from  table
where
 Emp_name   like   "*rama*"

I will get the following error.



 Zope Error
Zope has encountered an error while publishing this resource.
Error Type: SyntaxError
Error Value: unexpected token sequence.near :: 'est\012where \012Emp_name'*'
like "*rama*"' *** current state = 57 expects:
'HAVING', 'UNION', 'GROUP', 'VARCHAR', 'DESC', 'SELECT', 'ORDER', 'WHERE',
'AS', 'EXCEPT', '*', 'IN', 'INTERSECT', 'FLOAT', '+', '(', ')', '.', '/',
',', '-', 'AND', 'FROM', '*', ';', 'INTEGER', 'NOT', '>', 'OR', '=',
'BETWEEN', 'ASC', '<', 'VALUES', ('nomatch1',) current token = ((-8,
'user_defined_name'), 'LIKE')



kindly help
thanks
bye
subrahmanyan.


___
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] SQL Method, dtml-with and namespace weirdness

2001-01-10 Thread Dieter Maurer

Mayers, Philip J writes:
 > I'm wondering if it's a bug in the postgres DA, since I can't reproduce it
 > with a quick gadfly test. I'm just going to try it out now.
That would be very astonishing, as a database adapter
does not have anything to do with namespaces.


Dieter

___
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] SQL Method, dtml-with and namespace weirdness

2001-01-10 Thread Mayers, Philip J

Ok, using Postgresql 7.0.2-2, PoPo 2.0.1, ZPoPyDA 1.1-pre2, Zope 2.2.5,
here's a reproducible scenario:

Create the following tables in your database:

create table bugtest1 (
name text,
domain text,
);

create table bugtest2 (
name text,
domain text,
refer text,
foreign key(refer) references bugtest1(name)
);

insert into bugtest1 values ('a','aa');
insert into bugtest1 values ('b','bb');
insert into bugtest1 values ('c','cc');
insert into bugtest2 values ('w','ww','a');
insert into bugtest2 values ('x','xx','a');
insert into bugtest2 values ('y','yy','a');
insert into bugtest2 values ('z','zz','a');
insert into bugtest2 values ('g','gg','b');
insert into bugtest2 values ('h','hh','b');
insert into bugtest2 values ('i','hh','b');

Create the following folder structure:

/root
  dbconn (ZPoPyDA connection to whatever database you just put the tables
in)
  index_html
  get_host (Z SQL method)
  get_alias (Z SQL method)
  /alias
show
  /host
show

/root/get_host

select * from bugtest1

/root/get_alias

select * from bugtest2

  


/root/alias/show

&dtml-name;&dtml-domain;

/root/host/host

&dtml-name;&dtml-domain;

/root/index_html:

  1: 
  2: 
  3: 
  4:   
  5:   
  6: 
  8: 
  9:   POINT
A&dtml-name;&dtml-domain;
 10:   POINT
B&dtml-name2;&dtml-domain2;
 11:   
 12: 
 13: POINT C&dtml-name;&dtml-domain;
 14: POINT
D&dtml-name2;&dtml-domain2;
 15: 
 16:   
 17: 
 18: 
 19: 


The output of all that is (a bit hard to read):

a aa 

POINT A a aa 
POINT B w ww 
 a aa 
POINT C w ww 
POINT D w ww 

POINT A a aa 
POINT B x xx 
 a aa 
POINT C x xx 
POINT D x xx 

POINT A a aa 
POINT B y yy 
 a aa 
POINT C y yy 
POINT D y yy 

POINT A a aa 
POINT B z zz 
 a aa 
POINT C z zz 
POINT D z zz 




So: at point A, the "name" and "domain" variables have been overwritten with
the "name" and "domain" variables as they were on line 6/7, *BUT* name2 and
domain2 haven't been overwritten (point B). BUT, outside the dtml-with tab
(point C) "name" and "domain" are at their correct values.

So - given that the dtml-with tag "must" work, I'm clearly not understanding
*how* it works.

Regards,
Phil

+--+
| Phil Mayers, Network Support |
| Centre for Computing Services|
| Imperial College |
+--+  

___
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] SQL Method, dtml-with and namespace weirdness

2001-01-10 Thread Chris Withers

"Mayers, Philip J" wrote:
> 
> Sorry - I'm being unclear: the result is exactly the same either way i.e.
> the variables "name" and "domain" seem to be reset to the values from
> outside the dtml-in block when entering the dtml-with block.

> > > Change your show method in root to be as follows:
> > >
> > > 
> > >  
> > >  
> > >   
> > >  
> > > 
> > >
> > > And add another DTML method in root as follows:
> > >
> > > show_row:
> > > 
> > >   
> > >   &dtml-name;
> > >   &dtml-domain;
> > > 

Now I could grep the above to be sure, but I'm prety certain there
aren't any dtml-with's in there...
Perhaps the above might be worth trying out? ;-)

cheers,

Chris

___
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] SQL Method, dtml-with and namespace weirdness

2001-01-10 Thread Mayers, Philip J

Sorry - I'm being unclear: the result is exactly the same either way i.e.
the variables "name" and "domain" seem to be reset to the values from
outside the dtml-in block when entering the dtml-with block.

I'm wondering if it's a bug in the postgres DA, since I can't reproduce it
with a quick gadfly test. I'm just going to try it out now.

I'm using Zope 2.2.5, PoPy 2.0.1 from SourceForce, and ZPoPyDA-1.1-pre2 - I
couldn't get any (potentially more stable) combination of PoPy or ZPoPyDA to
work.

Regards,
Phil

+--+
| Phil Mayers, Network Support |
| Centre for Computing Services|
| Imperial College |
+--+  

-Original Message-
From: Chris Withers [mailto:[EMAIL PROTECTED]]
Sent: 10 January 2001 13:30
To: Mayers, Philip J
Cc: '[EMAIL PROTECTED]'
Subject: Re: [Zope] SQL Method, dtml-with and namespace weirdness


"Mayers, Philip J" wrote:
> 
> > Change your show method in root to be as follows:
> > 
> > 
> >  
> >  
> >   
> >  
> > 
> > 
> > And add another DTML method in root as follows:
> > 
> > show_row:
> > 
> >   
> >   &dtml-name;
> >   &dtml-domain;
> > 
> > 
> > so you have:
> >  /root
> >get_machine_hosts (SQL method)
> >get_host_aliases (SQL method)
> >show (dtml method)
> >show_row (dtml method)
 
> That was how I had the code originally. Didn't help. 

What happens when you try that? Errors? Unexpected values?

> I've already read the
> Zope 'book' 

Yes, it is frustrating how long it's taking for that to get printed, I
wonder what's holding it up?

> (if I were using 2.3 (which I can't, because LoginManager
> doesn't work OOTB),

I remember seeing the posts relating to that, did you ever find out why
it wasn't working? 

> I'd be using Python methods to do most of this instead.
> I'm not, I'm using 2.2.5)

Wise choice, but you mean python scripts in 2.3 ;-)
You can actually download Python _Methods_ right now and use them in
2.2.5:
http://www.zope.org/Members/4am/PythonMethod

cheers,

Chris

___
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] SQL Method, dtml-with and namespace weirdness

2001-01-10 Thread Chris Withers

"Mayers, Philip J" wrote:
> 
> > Change your show method in root to be as follows:
> > 
> > 
> >  
> >  
> >   
> >  
> > 
> > 
> > And add another DTML method in root as follows:
> > 
> > show_row:
> > 
> >   
> >   &dtml-name;
> >   &dtml-domain;
> > 
> > 
> > so you have:
> >  /root
> >get_machine_hosts (SQL method)
> >get_host_aliases (SQL method)
> >show (dtml method)
> >show_row (dtml method)
 
> That was how I had the code originally. Didn't help. 

What happens when you try that? Errors? Unexpected values?

> I've already read the
> Zope 'book' 

Yes, it is frustrating how long it's taking for that to get printed, I
wonder what's holding it up?

> (if I were using 2.3 (which I can't, because LoginManager
> doesn't work OOTB),

I remember seeing the posts relating to that, did you ever find out why
it wasn't working? 

> I'd be using Python methods to do most of this instead.
> I'm not, I'm using 2.2.5)

Wise choice, but you mean python scripts in 2.3 ;-)
You can actually download Python _Methods_ right now and use them in
2.2.5:
http://www.zope.org/Members/4am/PythonMethod

cheers,

Chris

___
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] SQL "editing"

2001-01-05 Thread Stuart Foster

We use the Znolk wizard. It's good for creating the initial entry, edit, 
list forms as well as the queries to add, edit and delete.

>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 1/5/01, 10:47:14 AM, Alex Burton <[EMAIL PROTECTED]> wrote regarding 
[Zope] SQL "editing":


>   Hello All,

>   I'm quite happy, got MySQL + the necessary adapters running in no
> time. Imported tab-delimited text and enjoying Zsearches... Zope
> kicks ass!

>   Now, i'm wondering if there's anyone who've done some work as to
> permit easy editing of records in SQL tables? What i have in kind is
> something like:

>   - do a search -> a list of matches come up;
>   - select a match -> a form comes up filled with the data, and a
> "submit" button
>   - press submit -> SQL gets altered

>   A bit like the "edit this page" philosophy, but for SQL records...

>   Thanks!

>   Alex.


> ___
> 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] SQL "editing"

2001-01-05 Thread Mohan Baro

You can use the ZNolk SQL wizard also available from zope.org

Mohan


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Alex
Burton
Sent: Friday, January 05, 2001 12:47 PM
To: [EMAIL PROTECTED]
Subject: [Zope] SQL "editing"



  Hello All,

  I'm quite happy, got MySQL + the necessary adapters running in no 
time. Imported tab-delimited text and enjoying Zsearches... Zope 
kicks ass!

  Now, i'm wondering if there's anyone who've done some work as to 
permit easy editing of records in SQL tables? What i have in kind is 
something like:

  - do a search -> a list of matches come up;
  - select a match -> a form comes up filled with the data, and a 
"submit" button
  - press submit -> SQL gets altered

  A bit like the "edit this page" philosophy, but for SQL records...

  Thanks!

Alex.
 

___
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] SQL "editing"

2001-01-05 Thread Alex Burton


  Hello All,

  I'm quite happy, got MySQL + the necessary adapters running in no 
time. Imported tab-delimited text and enjoying Zsearches... Zope 
kicks ass!

  Now, i'm wondering if there's anyone who've done some work as to 
permit easy editing of records in SQL tables? What i have in kind is 
something like:

  - do a search -> a list of matches come up;
  - select a match -> a form comes up filled with the data, and a 
"submit" button
  - press submit -> SQL gets altered

  A bit like the "edit this page" philosophy, but for SQL records...

  Thanks!

Alex.
 

___
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 query from "Multiple Selection Field"(was: [Zope] [Newbie] ZSQL problem) (was: [Zope] [Newbie] ZSQL problem)

2001-01-04 Thread Dieter Maurer

Hi Michal,

Michal Seta writes:
 > ... query
 >"select ... where col = "
 > works for single value but not for multiple selection ...

This is difficult indeed, as you have to fight
various strange behaviours.

First, it is easy to explain, why your query does not work:

  When you select more then one value from the selection
  list, then "multiple_section" will be a list.
  Your "sqlvar ... type=string" converts this into a string
  that looks like "[ 'a', 'b', 'c']".
  This string is then compared to your database column.
  You easily see, the result will be false.

Your SQL query is not correct to search for a value
in a list of possible values. You must use something
like

 select ... where col in ( 'a', 'b', 'c' )

How to construct such a query?
If you know, that your values do not contain quotes (i.e. '),
then you can use "_.string.join" like this:

 select ... where
 col in (  )

Now, your code will work, when you select more than one value
from the list. It will fail, if you select a single item
(or none at all).

It fails for a single selected value, because in this case
"multiple_selection" is not a list but a single value.
Fortunately, if you put the ":list" suffix at the form
variable name (like ""),
then you tell ZPublisher, that you want this to be a list.
In this case, you will get a list with one value.
This works well...

... up to the case, where no value is selected.


In this case, the variable is completely missing from the
request. You probably will get a "Bad request; missing
arguments ['multiple_selection']" from your ZSQL method.

In your case, it is probably best, to catch this case
in the DTML code that handles your form and report a nice
error.


After you became more familiar with Zope and the rough edges
of HTML form processing, you will hit cases where the above
approach is not adequate.
You can then ask again in the list (or search the searchable
list archive).


Dieter

___
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 Interface Builder?

2000-12-18 Thread Olaf Zanger

hi there,

i'm working with zope now for a month. i found the znolk product that
generates
some nice forms and so on.

i'm in desperate need for some more functionality though and i'm
wondering if anything out there might suit my needs, that are:

* customizable with a template or so (without the need to work on the
python method as is right now)

* edit mode to rearrang things later (now everything has to be done by
new each time when the python script gets changed)

* report support for more than the standard "select * from xxx"

an other question:
is there a chance to use the ftp thing with a kio_slave programm from
kde?

so, has anybody a solution to offer.

olaf

p.s. i find zope great. 


-- 
soli-con Engineering Zanger
Dipl.-Ing. (FH) Olaf Zanger Nusch
Lorrainestrasse 23
3013 Bern / Switzerland
Fon: +41-31-332 9782
Mob: +41-76-572 9782
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
http://www.soli-con.com

begin:vcard 
n:Zanger;Olaf Marc
tel;cell:+41-76-572 9782
tel;work:+41-31-332 9782
x-mozilla-html:FALSE
url:www.soli-con.com
org:soli-con Engineering Zanger
adr:;;Lorrainestrasse 23;Bern;BE;3013;Switzerland
version:2.1
email;internet:[EMAIL PROTECTED]
title:Dipl.-Ing.
note;quoted-printable:IT-Consulting=0D=0AEmbedded Systems=0D=0AEnergy Systems=0D=0AOpen Source Solutions=0D=0A
x-mozilla-cpt:;-32176
fn:Olaf Zanger
end:vcard



Re: [Zope] sql query results -> DTML method problem

2000-12-18 Thread Dieter Maurer

"Manuel Amador (Rudd-O) writes:
 > > #8 
 > 
 > RING: dont do that, dtml wont work in python namespace
 > instead, remember that in python namespace all vars present in dtml namespace 
 > are inherited.
I do not see a reason, why not to use this
(except, that " should not be escaped, of cause).

 > do this:
 >  
 > the __.() construct is required since underscore arent allowed in python 
 > variable names. if the var was called classcode, you could do
"_" are allowed in Python names. They are treated in the same
way as a letter.

DTML restricts the use of "_":

  A name must not *START* with an "_" (unless it is the special
  name "_").
  Inside name, you can use "_" freely.

 >  
 > dats it.
That said, you can also use:


 > > )\"> *** syntax
 > > error
I agree with Manuel:
  you cannot nest DTML.
And it is this nesting, that triggered his "RING: do not do that!"

Use:

 

I.e. you can simply use the name of the variable.

Manuel is right, too, that DTML allows much more characters
in names than Python does. If you have a name with a character
forbidden in Python names, such as e.g. a "-", then you
can use "_[name]" or "_.getitem(name)" (as Manuel said).
It is only, that "_" (unlike "-") is allowed in Python names.



Dieter

___
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] sql query results -> DTML method problem

2000-12-16 Thread Manuel Amador (Rudd-O) Gerente de desarrollo Alpha

Quoting Lee Reilly CS1997 <[EMAIL PROTECTED]>:

> Hi,
> 
> I have a TINY problem, which I think there is a simple solution too...
> but for the life of me, I can\'t find it! I\'d be grateful if someone
> could point me in the right direction.
> 
> I have a database setup containing details of classes, students &
> lecturers. The user is prompted to enter a class code (a unique key)
> which is used to query the database and return the class title. Simple.
> 
> A DTML method prompts me for the class code
> -- I enter 52.139 and it posts to a method \'enterClassCodeAction\',
> below.
> 
> #1
> #2Confirm
> #3You entered 
> #4
> #5
> #6Our records show that  is called
> #7
> #8

RING: dont do that, dtml wont work in python namespace
instead, remember that in python namespace all vars present in dtml namespace 
are inherited.

do this:

the __.() construct is required since underscore arent allowed in python 
variable names. if the var was called classcode, you could do

dats it.

> #9
> #10   
> #11   
> #12
> #13   
> #14   
> 
> ^ The method works fine when the class code is manually inserted (line
> #8) but when I try to pass the variable from the previou post, held in
>  I have probs.
> 
> )\"> *** syntax
> error
> 
> findClassTitle is a ZSQL method for returning the class title given a
> class code:
>   
>   select title from classes 
>   where 
> 
> Hmm... anyone see the problem?
> 
> Thanks a lot :)
> 
> - Best regards,
> 
> Lee
> 
> ___
> 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 )
> 

--
   Universidad Federico Santa Maria - Campus Guayaquil
 Enviado por:  www.usm.edu.ec/computacion

___
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] sql query results -> DTML method problem

2000-12-16 Thread Pavel V. Piankov

>#8 

you might wanna try 
either 
or 

> *** syntax
>error

regards.
-- 
pashah


___
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 query results -> DTML method problem

2000-12-16 Thread Lee Reilly CS1997

Hi,

I have a TINY problem, which I think there is a simple solution too...
but for the life of me, I can't find it! I'd be grateful if someone
could point me in the right direction.

I have a database setup containing details of classes, students &
lecturers. The user is prompted to enter a class code (a unique key)
which is used to query the database and return the class title. Simple.

A DTML method prompts me for the class code
-- I enter 52.139 and it posts to a method 'enterClassCodeAction',
below.

#1  
#2  Confirm
#3  You entered 
#4
#5  
#6  Our records show that  is called
#7
#8  
#9  
#10 
#11 
#12
#13 
#14 

^ The method works fine when the class code is manually inserted (line
#8) but when I try to pass the variable from the previou post, held in
 I have probs.

 *** syntax
error

findClassTitle is a ZSQL method for returning the class title given a
class code:

select title from classes 
where 

Hmm... anyone see the problem?

Thanks a lot :)

- Best regards,

Lee

___
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] SQL and dtml-tree

2000-11-30 Thread Dieter Maurer

> ... dtml-tree with SQL tables ...
There is a HowTo on zope.org about advanced usage of dtml-tree.
Search for "tree".
I think, it covers the use of "dtml-tree" with SQL tables.


Alternatively, you may search the list archive (at NIP).
There are several threads on this issue.


Dieter



___
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

2000-11-29 Thread Mike Kelland



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]
 


Re: [Zope] SQL cursor error

2000-10-18 Thread knight

The first problem is your are running Microsoft. Just kidding.

On Wed, 18 Oct 2000, steve smith wrote:

> Anyone know what this means?
> 
> Error Type: sql.error
> Error Value: ('24000', 0, '[Microsoft][ODBC SQL Server Driver]Invalid cursor
> state'
> I get this when I try to submit a form which passes control to a dtml
> method. that method in turn makes a dtml-call to another, which calls a SQL
> method.
> 
> 
> Regards
> Steve Smith
> 
> 
> ___
> 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] SQL cursor error

2000-10-18 Thread steve smith

Anyone know what this means?

Error Type: sql.error
Error Value: ('24000', 0, '[Microsoft][ODBC SQL Server Driver]Invalid cursor
state'
I get this when I try to submit a form which passes control to a dtml
method. that method in turn makes a dtml-call to another, which calls a SQL
method.


Regards
Steve Smith


___
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] SQL errors

2000-10-01 Thread Andy McKay

Of course, thank you. That works just fine.

- Original Message -
From: "Dieter Maurer" <[EMAIL PROTECTED]>
To: "Andy McKay" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, September 29, 2000 2:55 PM
Subject: Re: [Zope] SQL errors


> Andy McKay writes:
>  > Using ZODBC Database Adapter to connect to an MSSQL and I can call the
sql
>  > method in dtml eg:
>  >
>  > 
>  >   
>  > 
>  > Error!
>  > 
>  >
>  > But does anyone know a way of trapping the specific error eg: database
down,
>  > key violation etc...? Or do I have to hack ZODBC to return different
errors?
> You know the "error_value" variable defined inside the "dtml-except"?
>
> Maybe, it can give you additional information about the kind
> of error.
> If it is the wrong one, reraise the exception.
>
>
> Dieter
>
> ___
> 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] SQL errors

2000-09-29 Thread Dieter Maurer

Andy McKay writes:
 > Using ZODBC Database Adapter to connect to an MSSQL and I can call the sql
 > method in dtml eg:
 > 
 > 
 >   
 > 
 > Error!
 > 
 > 
 > But does anyone know a way of trapping the specific error eg: database down,
 > key violation etc...? Or do I have to hack ZODBC to return different errors?
You know the "error_value" variable defined inside the "dtml-except"?

Maybe, it can give you additional information about the kind
of error.
If it is the wrong one, reraise the exception.


Dieter

___
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 errors

2000-09-28 Thread Andy McKay

Using ZODBC Database Adapter to connect to an MSSQL and I can call the sql
method in dtml eg:


  

Error!


But does anyone know a way of trapping the specific error eg: database down,
key violation etc...? Or do I have to hack ZODBC to return different errors?

--
  Andy McKay, Developer.
  ActiveState.


___
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] SQL

2000-09-20 Thread Dieter Maurer

Tom Deprez writes:
 > Somebody experience with a parent code table and how to implement it in
 > Zope (with dtml-tree)?
 > Or is a PArent-Code table not SQL-like and is there a better solution?
 > 
 > eg : 
 > 
 > Parent Code Description
 >   0 0   MasterNode
 >   0 1   Child1 of MasterNode
 >   0 2   Child2 of MasterNode
 >   1 3   Child of Child1

There should be a HowTo on zope.org about sophisticated
dtml-tree usage. Make a search.

Some months ago, there has been a thread in this list
about a problem with tree generation by means of
a Z SQL method. The problem was solved.
You may search the archive to get more details.



Dieter

___
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] SQL

2000-09-20 Thread Rik Hoekstra


>
> Somebody experience with a parent code table and how to implement it in
> Zope (with dtml-tree)?
> Or is a PArent-Code table not SQL-like and is there a better solution?
>
> eg :
>
> Parent Code Description
>   0 0   MasterNode
>   0 1   Child1 of MasterNode
>   0 2   Child2 of MasterNode
>   1 3   Child of Child1
>
> 

Hi Tom,

There is a good Howto by anthony Baxter on this subject called Some Neat
tricks with dtml-tree. It is at
http://www.zope.org/Members/anthony/tree-coding-tricks This should get you
started

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 )




Re: [Zope] SQL

2000-09-20 Thread Stephan Richter

At 02:14 PM 9/20/00 +0200, Tom Deprez wrote:
>Hi,
>
>Somebody experience with a parent code table and how to implement it in
>Zope (with dtml-tree)?
>Or is a PArent-Code table not SQL-like and is there a better solution?

No, it is a good solution. I used it many times for threaded message 
boards. But I do not know how to handle it with the tree tag. If you write 
your own Zope Product, it should be possible.

Regards,
Stephan
--
Stephan Richter
CBU - Physics and Chemistry Student
Web2k - Web Design/Development & Technical Project Management


___
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

2000-09-20 Thread Tom Deprez

Hi,

Somebody experience with a parent code table and how to implement it in
Zope (with dtml-tree)?
Or is a PArent-Code table not SQL-like and is there a better solution?

eg : 

Parent Code Description
  0 0   MasterNode
  0 1   Child1 of MasterNode
  0 2   Child2 of MasterNode
  1 3   Child of Child1



Thanks in advance,

Tom.



___
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-Session 3.0 -- session won't be writen to database

2000-09-03 Thread Andy Pahne



Hi,

I'm playing around with SQLSession-3.0

When I do something like the following:


   
   
   

my session variable "foo" renders as I expected. But when I move to another
page my session-variable "foo" is not available.

Creating a session works perfect and the next page remembers about the
created session and gives me the correct name, but no session-variables.

I checked the database and there werde no entries in my session-data table.
Am I missing something like
  
or what?



Andy Pahne
[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] SQL Methods

2000-09-02 Thread Tino Wildenhain

Hi Campaan,

RC Compaan wrote:
> 
> I have a sql method and a dtml method calling the sql method.  They live in
> the same folder and the dtml method's proxy roles are set.  I've tried
> everything and Zope tells me I don't have permission to do view the sql
> result returned by the sql method.  This worked fine in Zope 2.1.6 so I
> guess it has something to do with the new security model.  I also have
> explicit ownership of all objects that I'm working with - still no luck.

There was a bug in sql-methods returning subobjects without giving them
the proper access rights. This was due to a change in the security
mechanism
on 2.2.x. The default policy is now: disallow everything as log as its
not
explicitely permittet.
I would suggest to look for the patch on sql-methods or simply upgrade
to
the latest 2.2.1 where this (and much more) has already been fixed.

Regards
Tino Wildenhain

___
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] SQL Methods

2000-08-31 Thread Bak @ kedai

i think you need to look at the sql methods permission.

-Original Message-
From: RC Compaan <[EMAIL PROTECTED]>
To: Zope <[EMAIL PROTECTED]>
Date: Thursday, August 31, 2000 3:06 PM
Subject: [Zope] SQL Methods


>I have a sql method and a dtml method calling the sql method.  They live in
>the same folder and the dtml method's proxy roles are set.  I've tried
>everything and Zope tells me I don't have permission to do view the sql
>result returned by the sql method.  This worked fine in Zope 2.1.6 so I
>guess it has something to do with the new security model.  I also have
>explicit ownership of all objects that I'm working with - still no luck.
>
>Any advise?
>
>Roché
>
>
>___
>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] SQL Methods

2000-08-31 Thread RC Compaan

I have a sql method and a dtml method calling the sql method.  They live in
the same folder and the dtml method's proxy roles are set.  I've tried
everything and Zope tells me I don't have permission to do view the sql
result returned by the sql method.  This worked fine in Zope 2.1.6 so I
guess it has something to do with the new security model.  I also have
explicit ownership of all objects that I'm working with - still no luck.

Any advise?

Roché


___
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] SQL question...I think

2000-08-29 Thread Dieter Maurer

George writes:
 > 
 > I know how to insert data in to the table,
 > search and such. I can not find any info on how to embed the data in my
 > dtml-html code to show it to the world.
Because, you can already search, you do already embed data in
dtml-html to show it to the world.
You just do not yet realized it

Okay, one step further:

 * In your "Available Objects", you will find an entry
   Z Search Interface.

   Add it to a folder!

   It will ask for a connection id, and id for the search form
   and the report.

 * The report presents search results to the world.
   It is a DTML method.
   Look at it, look at the DTML documentation,
   try to understand "dtml-in" and its parameters.

 * Change the report by removing columns (the columns, you
   do not want to show).

 * Play with the "size" and the "orphan" (these are 
arguments).

 * If you still do not yet get, what you want
   (then you will already have high requirements),
   then notice the following facts:

- the result of an Z SQL method behaves like a sequence

- "_.len" gives its length, i.e. the number of hits

- "...[i]" gives you the "i"th hit

- each hit behaves as an object with the columns as attributes

   Do not be frustrated, if you do not get this handled at the
   first trial.


Dieter

___
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 question...I think

2000-08-29 Thread George

I know nothing about sql so forgive me this idiotic question:-) All I
know so far I had learnt from ZOPE tutorials and HOW-TO's. Here is the
question:
I have a database connection working. I created a couple of tables and
filled them up with stuff. I know how to insert data in to the table,
search and such. I can not find any info on how to embed the data in my
dtml-html code to show it to the world. I know how to create a form for
the visitors to search for the stuff. What I need is simply include some
data in my documents without any interaction.
If I have for instance a table that contains a columns: product_id,
price, weight. How do I display the values one by one? (not the whole
table) I have some data in the table that I do not want to display on
every page. Can I choose just one row and column and display just that
data in that single cell? Say only the price of the product number
1?

Regards,
George


___
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] SQL trees...

2000-08-21 Thread Mayers, Philip J

Confirmed. Downgrading to 2.1.4 fixed it. How annoying...

Thanks a lot!

Regards,
Phil

+--+
| Phil Mayers, Network Support |
| Centre for Computing Services|
| Imperial College |
+--+ 

-Original Message-
From: Philipp Auersperg [mailto:[EMAIL PROTECTED]]
Sent: 21 August 2000 18:31
To: Mayers, Philip J; [EMAIL PROTECTED]
Subject: Re: [Zope] SQL trees...


Which Zope version do you use ?

When I read your message I have a deja-vu:
I encountered the same output when I use SQL based trees under Zope 2.1.6,
it is a bug somewhere in the SQL method handling that appeared in 2.1.6 and
is 
fixed in 2.2.0.

Solution:
switch back to 2.1.4 or forward to 2.2.0 or patch the existing 2.1.6 

Philipp Auersperg (zwork)

___
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] SQL trees...

2000-08-21 Thread Philipp Auersperg

Which Zope version do you use ?

When I read your message I have a deja-vu:
I encountered the same output when I use SQL based trees under Zope 2.1.6,
it is a bug somewhere in the SQL method handling that appeared in 2.1.6 and is 
fixed in 2.2.0.

Solution:
switch back to 2.1.4 or forward to 2.2.0 or patch the existing 2.1.6 

Philipp Auersperg (zwork)

*** REPLY SEPARATOR  ***

On 21.08.2000 at 16:43 Mayers, Philip J wrote:

>Excellent. That answers that.
>
>I'm loath to ask this, since it's supposedly a FAQ, but I'm having trouble
>with the tree...
>
>Following:
>
>http://www.zope.org/Members/anthony/tree-coding-tricks
>
>I've got:
>
>
>
>  
>
>
>
>The SQL query is working - "test"ing network_children will give the correct
>hierarchy. However, the tree generated looks like this:
>
>192.168/16
>  192.168/16
>192.168/16
>10/8
>172.20/16
>  10/8
>192.168/16
>10/8
>172.20/16
>  172.20/16
>192.168/16
>10/8
>172.20/16
>10/8
>  
>
>Basically, the tree only seems to ever contain the top-level (children of
>the root of the tree).  The children of all the nodes is... another copy of
>the root top-level nodes! Whu?!? A search for several variations of "SQL
>tree" in all the relevant list/site archives didn't seem to help. Any ideas?
>
>Regards,
>Phil
>
>+--+
>| Phil Mayers, Network Support |
>| Centre for Computing Services|
>| Imperial College |
>+--+ 
>
>-Original Message-
>From: Chris Withers [mailto:[EMAIL PROTECTED]]
>Sent: 21 August 2000 15:23
>To: Mayers, Philip J
>Cc: '[EMAIL PROTECTED]'
>Subject: Re: [Zope] dtml-let and quoting(?) or forcing to string
>
>
>"Mayers, Philip J" wrote:
>> 
>> 
>>   
>> 
>> 
>
>Anything in a DTML tag that's inside "" is python, usually ;-)
>
>So, your dtml-let should be:
>
>
>which is kinda yucky, don't you think?
>
>cheers,
>
>Chris
>
>___
>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] SQL trees...

2000-08-21 Thread Mayers, Philip J

Excellent. That answers that.

I'm loath to ask this, since it's supposedly a FAQ, but I'm having trouble
with the tree...

Following:

http://www.zope.org/Members/anthony/tree-coding-tricks

I've got:



  



The SQL query is working - "test"ing network_children will give the correct
hierarchy. However, the tree generated looks like this:

192.168/16
  192.168/16
192.168/16
10/8
172.20/16
  10/8
192.168/16
10/8
172.20/16
  172.20/16
192.168/16
10/8
172.20/16
10/8
  

Basically, the tree only seems to ever contain the top-level (children of
the root of the tree).  The children of all the nodes is... another copy of
the root top-level nodes! Whu?!? A search for several variations of "SQL
tree" in all the relevant list/site archives didn't seem to help. Any ideas?

Regards,
Phil

+--+
| Phil Mayers, Network Support |
| Centre for Computing Services|
| Imperial College |
+--+ 

-Original Message-
From: Chris Withers [mailto:[EMAIL PROTECTED]]
Sent: 21 August 2000 15:23
To: Mayers, Philip J
Cc: '[EMAIL PROTECTED]'
Subject: Re: [Zope] dtml-let and quoting(?) or forcing to string


"Mayers, Philip J" wrote:
> 
> 
>   
> 
> 

Anything in a DTML tag that's inside "" is python, usually ;-)

So, your dtml-let should be:


which is kinda yucky, don't you think?

cheers,

Chris

___
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 )




  1   2   >