[Zope] MYSQL Problem

2001-01-27 Thread Jens Grewen



I installed 

mySQL-3.23.32
mySQLdb 0.3.1
ZmySQLDA 2.0.4

on Win98


From the following SQL statmentI get the 
result 233L and not 233 as expected

select count(PID)from product

When I run this SQL Statment from another program I 
get the expected value 233.


In my installation there are a lot of Z SQL Methods 
that should return an int value and when I use field description int in the 
databaseI always get this 'L' behind the expected result. A lot of things 
donĀ“t work because of this.

When I change to mediumint (database field 
description)I get the expected 233.

How can I fix this.


Thanks

Jens


Re: [Zope] ISPs that host zope

2000-11-07 Thread Jens Grewen

Hi Keith,

check out http://www.zope.org/Resources/ZSP

Jens Grewen

- Original Message -
From: "Keith Alperin" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, November 07, 2000 2:43 AM
Subject: [Zope] ISPs that host zope


 Greetings.  I am a complete zope newbie but am enthralled by the
technology.
 I am about to begin working on a personal web project and would like to
 build it in/with zope.  Can anyone recommend a good ISP that will:
 -host and support zope
 -give me access to an RDBMS (MySQL or any other system would more than
 suffice)
 -give me a reasonable amount of space (50MB)
 -not break my budget ($30.00 per month.)

 Does such an animal exist?  Please let me know what your experiences are
 with zope-friendly ISPs regardless of whether they meet my aforementioned
 criteria.

 Thank you so much.

 Keith R. Alperin
 Sr. Web Developer
 Ignite Sports Media
 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]


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



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




Re: [Zope] PIL/Zope Problem

2000-10-27 Thread Jens Grewen

Hi ,

 I use this external Methode to generate thumbs from an image an write both
 in an mysql database.
 May this helps you



 
 from PIL.Imageimport BICUBIC, BILINEAR, NEAREST
 from cStringIOimport StringIO

 import _mysql
 import MySQLdb
 import PIL

 def write(filename, pid):
   db=MySQLdb.connect(db="shop",user="zope",passwd="")
   c=db.cursor()
   imgfile=open(filename,'rb')
   sql_reset_img1="update PRODUCT set PIMAGE=NULL where PID="+ pid
   sqlstr="update PRODUCT set PIMAGE='" +
 _mysql.escape_string(imgfile.read()) +"' where PID="+ pid
   # do reset...
   c.execute(sql_reset_img1)
   # do the "update" load...
   c.execute(sqlstr)
   imgfile.close()
   im = PIL.Image.open(filename)
   fmt = im.format
   if fmt == 'PNG':
 fmt = 'JPEG'
   size = (int('75'),int('75'))
   x, y = im.size
   if x  size[0]: y = y * size[0] / x; x = size[0]
   if y  size[1]: x = x * size[1] / y; y = size[1]
   size = x, y
   im.draft(None, size)
   im = im.resize(size)
   im.size = size
   im.save('/home/zope/tempimage/temp.jpg', fmt)
   tempfile=open('/home/zope/tempimage/temp.jpg','rb')
   sql_reset_img2="update PRODUCT set PTHUMB=NULL where PID="+ pid
   sqlstri="update PRODUCT set PTHUMB='" +
 _mysql.escape_string(tempfile.read()) +"' where PID="+ pid
   # do reset...
   c.execute(sql_reset_img2)
   # do the "update" load...
   c.execute(sqlstri)
   tempfile.close()
   return 'image was written to db successfull'




Jens


- Original Message -
From: "Marcello Lupo" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, October 27, 2000 2:38 PM
Subject: [Zope] PIL/Zope Problem


 Hi to all,
 i read all the documentation and made all things to let interact PIL and
 Zope and i cannot find the way to make it work.
 If i try to import PIL from pyton interpreter it works perfectly with:

 ***
 Python 1.5.2 (#1, Jul 17 1999, 22:10:16)  [GCC egcs-2.91.66
 19990314/Linux (egcs- on linux2
 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
  import PIL
 
data=PIL.Image.open("/home/httpd/listanozze/docs/images/prove/ccc.jpg","r")
  print data.format
 JPEG
  print data.info
 {'adobe_transform': 1, 'progression': 1, 'adobe': 100, 'jfif': 258}
  print data.size
 (450, 309)
 
 **

 as you can see it works.
 But when i try to access PIL.Image.open from an external method in Zope
 i get:

 ***


  Error Type: AttributeError
  Error Value: Image



  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 the HTML source for this page.

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


 Traceback (innermost last):
   File /home/httpd/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line
 214, in publish_module
   File /home/httpd/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line
 179, in publish
   File /home/httpd/Zope-2.1.6-src/lib/python/Zope/__init__.py, line 202,
 in zpublisher_exception_hook
 (Object: ElementWithAttributes)
   File /home/httpd/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line
 165, in publish
   File /home/httpd/Zope-2.1.6-src/lib/python/ZPublisher/mapply.py, line
 160, in mapply
 (Object: pippo)
   File /home/httpd/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line
 102, in call_object
 (Object: pippo)
   File /home/httpd/Zope-2.1.6-src/lib/python/OFS/DTMLMethod.py, line
 150, in __call__
 (Object: pippo)
   File
 /home/httpd/Zope-2.1.6-src/lib/python/DocumentTemplate/DT_String.py,
 line 502, in __call__
 (Object: pippo)
   File
 /home/httpd/Zope-2.1.6-src/lib/python/DocumentTemplate/DT_Util.py, line
 335, in eval
 (Object: resize_image(foto))
 (Info: foto)
   File string, line 0, in ?
   File

/home/httpd/Zope-2.1.6-src/lib/python/Products/ExternalMethod/ExternalMethod
.py,
 line 255, in __call__
 (Object: resize_image)
 (Info: ((ZPublisher.HTTPRequest.FileUpload instance at 8565c90,),
 {}, None))
   File /home/httpd/Zope-2.1.6-src/Extensions/image_op.py, line 7, in
 resize_image
 (Object: ElementWithAttributes)
 AttributeError: (see above)

 *

 My external Method say:
 
 import PIL

 def resize_image(self, foto):

 if foto:
 data=PIL.Image.open(foto)
 data=data.resize((128, 128))
 return data.size
 else:
 return "Nothing"

 

Re: [Zope] Z SQL Objects (Newbie)

2000-10-26 Thread Jens Grewen



Hi,

Arguments| team

Query template

dtml-if "team == '5'"
 select *
 from data
dtml-else

 select *
 from data/dtml-if

this is normal

but may it helps if you post the traceback of the 
error message

Jens Grewen

- Original Message - 

  From: 
  Yvonne 
  Totty 
  To: [EMAIL PROTECTED] 
  Sent: Thursday, October 26, 2000 3:22 
  PM
  Subject: [Zope] Z SQL Objects 
  (Newbie)
  
  I 
  have the O'Reilly book, but can't seem to find more
  complete information on how to do 'if's' in a SQL 
  thing.
  
  Here's the scenario:
  I 
  have three different 'teams' and want to run a call
  specific to each team. I am passing in three 
  parameters,
  two of which go in the sql statement, the other goes 
  in 
  the if statement:
  :if "team='S"'
  sql statement
  :elif "team='C'"
  blah, blah
  /:if
  
  It tells me it doesn't like the syntax of the 'if' (I 
  have
  stuff in the python file that lets me use ':' in 
  place of
  'dtml-'). I have tried all the flavors: 
  "team=='S'",
  "team=S", "team==S", etc. and it doesn't like any 
  of
  them.
  
  If you guys know of another reference, please let 
  me
  know!
  
  TIA,
  Yvonne 8)
  ~~~
  Yvonne Totty
  Database Engineer
  -
  Wolverine: You actually go 
  outside in these things?Cyclops: Well, what would you prefer? Yellow 
  spandex?
  


Re: [Zope] dtml-if url type contruct

2000-10-24 Thread Jens Grewen

Hi,

I am not quite sure if this is what you want but may this helps

dtml-with bar
  dtml-if "REQUEST.has_key('foo')"
 do something
  /dtml-if
/dtml-with

This is not resolving the URL.
If you found a solution let me know.

Jens Grewen


- Original Message -
From: "kosh" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, October 24, 2000 10:56 PM
Subject: [Zope] dtml-if url type contruct


 What would be the correct dtml-if contrstruct for this behavior?

 I want to check and see if zope can resolve a url to a valid object.

 Ie does http://foo.com/bar/foo get you to a valid page or is it not
 found.

 I need something like dtml-if http://foo.com/bar/foo that way I can know
 when to rewrite the url based on zope finding the object or not.

 Thanks
 Kosh


 ___
 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] Re: [Zope-dev] Problems with offline MS IE 5

2000-10-20 Thread Jens Grewen

I was fighting with the same problem and I thought it depends on my proxy
setting. But now I thing it depends on the Browser version because I
installed IE5.5 and the problem was gone. (ocularly same settings).


- Original Message -
From: "Ross Boylan" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, October 20, 2000 8:09 AM
Subject: [Zope-dev] Problems with offline MS IE 5


 I recently tried doing some Zope development on a laptop and ran into a
 problem: when I updated a product the updates did not "take."  In
 particular, when I edited the text in a .dtml file and restarted Zope, I
 still saw the old text  when I got to the appropriate point (the file was
 wrapped in an HTMLFile() and used for creating a new instance of one of
the
 products in the package).

 I think I checked all of the following:
 * the file was getting updated
 * all instances of explorer were shut down
 * MSIE options set to "Check for newer version of stored page on every
 visit to the page"

 A notable peculiarity was that whenever I tried to access my local zope, I
 would get a "you are offline, do you wish to go online" message (I even
 used localhost as the machine name!).  I would say yes, it would say it
 couldn't connect and ask if I wanted to try again.  I said yes, but then I
 ran into the problems described above.

 Zope 2.2.2 on MS W2K with MS IE 5.0.

 Does this ring any bells with anyone?  Is it an IE problem?  a Zope
 problem?  an interaction?


 ___
 Zope-Dev maillist  -  [EMAIL PROTECTED]
 http://lists.zope.org/mailman/listinfo/zope-dev
 **  No cross posts or HTML encoding!  **
 (Related lists -
  http://lists.zope.org/mailman/listinfo/zope-announce
  http://lists.zope.org/mailman/listinfo/zope )



___
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] Problems with mysql and sql methode

2000-10-20 Thread Jens Grewen



Hi,

I have a problem with an SQL Methode with the this 
sql statement


select PAYMENT.PYNAME, PAYMENT.PYPRICEfrom 
MERCHANTPAYMENT, PAYMENTwhere MERCHANTPAYMENT.MEID = 418 and 
MERCHANTPAYMENT.PYID = PAYMENT.PYID

on the following tables:


MERCHANTPAYMENT
-
MPID int(30)
MEID int(30)
PYID int(30)
-

PAYMENT
-
PYID int(30)
PYNAME varchar(50)
PYPRICE varchar(50)
-

the statement runs under MS ACCESS (link over 
myODBC) and I get the correct resut but under zope sql methode I get no result. 
(There was no data 
matching)

Any ideas

Jens Grewen



Re: [Zope] Problems with mysql and sql methode

2000-10-20 Thread Jens Grewen

Ok know I get this problem
Error, _mysql.OperationalError: (1109, "Unknown table 'MERCHANTPAYMENT' in
where clause")


SQL used:

select PYNAME, PYPRICE
from PAYMENT
where MERCHANTPAYMENT.MEID = '418' and MERCHANTPAYMENT.PYID = PYID

other ideas?

Thanks

Jens Grewen

- Original Message -
From: "Farrell, Troy" [EMAIL PROTECTED]
To: "'Jens Grewen'" [EMAIL PROTECTED]; "Zope Maillist" [EMAIL PROTECTED]
Sent: Friday, October 20, 2000 10:04 PM
Subject: RE: [Zope] Problems with mysql and sql methode


 You may try:

 SELECT pyname, pyprice
 FROM payment
 WHERE merchantpayment.meid = 418 AND merchantpayment.pyid = payment.pyid

 I have a feeling mysql is not liking you for not selecting results from
 table MERCHANTPAYMENT becuase you said you would.

 Troy

 -Original Message-
 From: Jens Grewen [mailto:[EMAIL PROTECTED]]
 Sent: Friday, October 20, 2000 11:04 AM
 To: Zope Maillist
 Subject: [Zope] Problems with mysql and sql methode


 Hi,

 I have a problem with an SQL Methode with the this sql statement

 select PAYMENT.PYNAME, PAYMENT.PYPRICE
 from MERCHANTPAYMENT, PAYMENT
 where MERCHANTPAYMENT.MEID = 418 and MERCHANTPAYMENT.PYID = PAYMENT.PYID

 on the following tables:


 MERCHANTPAYMENT
 -
 MPID int(30)
 MEID int(30)
 PYID int(30)
 -

 PAYMENT
 -
 PYID int(30)
 PYNAME varchar(50)
 PYPRICE varchar(50)
 -

 the statement runs under MS ACCESS (link over myODBC) and I get the
correct
 resut but under zope sql methode I get no result. (There was no data
 matching)

 Any ideas

 Jens Grewen


 ___
 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] Problems with mysql and sql methode

2000-10-19 Thread Jens Grewen



Hi,

I have a problem with an SQL Methode with the this 
sql statement


select PAYMENT.PYNAME, PAYMENT.PYPRICEfrom 
MERCHANTPAYMENT, PAYMENTwhere MERCHANTPAYMENT.MEID = 418 and 
MERCHANTPAYMENT.PYID = PAYMENT.PYID

on the following tables:


MERCHANTPAYMENT
-
MPID int(30)
MEID int(30)
PYID int(30)
-

PAYMENT
-
PYID int(30)
PYNAME varchar(50)
PYPRICE varchar(50)
-

the statement runs under MS ACCESS (link over 
myODBC) and I get the correct resut but under zope sql methode I get no result. 
(There was no data 
matching)

Any ideas

Jens Grewen


[Zope] test

2000-10-16 Thread Jens Grewen