Re: [Zope] product security changes from 2.8 to 2.8.5 - SOLVED

2006-02-28 Thread Ed Colmar

hey All

It appears that I have solved it...

My process in moving over the product from the old server was to blame.  
Here's what I did:   export all of the zodb contents, and tarball the 
python product.  Then I imported the zodb contents into the new server, 
and un-tarred the product.  This resulted in the error of not finding 
the python methods, even though it appeard to be connected.


So, I added the product form the add menu, and copy/pasted the zodb 
contents, and now it's all happy.


For future refrence, is there a call to conenct this class back into the 
zodb filesystem after it has been moved to a new instance?


Thanks for all the help!

-e-

___
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] product security changes from 2.8 to 2.8.5 ?

2006-02-27 Thread Ed Colmar

Hello

I recently moved my zope product developed on a 2.8 server on to a 2.8.5 
server, and all of my python code is no longer being published out.


In the past I had been using a doc string   doc  to make methods 
accessible.  I realize this is not the proper procedure, but it worked.  
Now, on the 2.8.5 server, all of these are refused. 

I've been going through and doing security.declarePublic('methodname') 
on everything I want to be public, but it does not appear to have any 
effect.


Are there any other changes that I need to make to my product in order 
to get back the functionality I had previously?


Am I even looking in the right place?

Thanks for any tips

-e-


___
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] product security changes from 2.8 to 2.8.5 ?

2006-02-27 Thread Ed Colmar


Hey Andreas, thanks for the reply.

I have Globals.InitializeClass(classname) at the end of my product code 
(outside the class)
I turned on Verbose Security, but hmm...  maybe this is not a security 
issue after all.


I have code that worked within my product before like:

def send_password_reminder(self, email):
  blah 

Now I see get a name error when trying to access it.

*Error Type: NameError*
*Error Value: name 'send_password_reminder' is not defined

I thought it was a security problem...  Is this related to something else?

Thanks again!

-e-


*Andreas Jung wrote:




--On 27. Februar 2006 15:20:11 -0800 Ed Colmar [EMAIL PROTECTED] 
wrote:



Hello

I recently moved my zope product developed on a 2.8 server on to a 2.8.5
server, and all of my python code is no longer being published out.

In the past I had been using a doc string   doc  to make methods
accessible.  I realize this is not the proper procedure, but it worked.
Now, on the 2.8.5 server, all of these are refused.
I've been going through and doing 
security.declarePublic('methodname') on
everything I want to be public, but it does not appear to have any 
effect.


Are there any other changes that I need to make to my product in 
order to

get back the functionality I had previously?




Do you call InitializeClass()?
Perhaps VerboseSecurity might help you.

-aj



___
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] Error importing objects 2.8 2.7

2006-01-26 Thread Ed Colmar
*Been working up some code on a zope 2.8.0 install, and I wanted to move 
it over to a live server.  I keep getting this error:


Error Type: AttributeError*
*Error Value: 'module' object has no attribute '__newobj__'


The new server is curious becuase it reads:
*
Zope Version

(unreleased version, python 2.2.3, linux2)
Python Version

2.2.3 (#1, Aug 8 2003, 08:44:02) [GCC 3.2.3 20030502 (Red Hat Linux 
3.2.3-13)]




This was an RPM install as far as I remember.  2.7 I think

Do I need to get 2.8.0 on this production box, or is there an easy fix 
to get this .zexp imported?


thanks for any tips!

-e-
___
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] apache open proxy configuration problem

2005-12-22 Thread Ed Colmar

Hey Tino

Well, my access log fills up with lines like:

61.54.11.222 - - [21/Dec/2005:14:36:56 -0800] GET 
http://media.fastclick.net/w/get.media?sid=19765m=3tp=7d=sc=1 
HTTP/1.1 404 927
59.32.21.156 - - [21/Dec/2005:14:37:10 -0800] GET 
http://www.searchvill.com/index.php?uid=1077REQ=Poker%20Betting 
HTTP/1.0 404 935
222.208.183.2 - - [21/Dec/2005:14:40:05 -0800] GET 
http://adsence.sogou.com/index.html?pid=info-xa163ww=120dc=3dir=0num=6color=1charset=gb 
HTTP/1.0 404 936
222.208.183.2 - - [21/Dec/2005:14:40:06 -0800] GET 
http://log.cpc.sohu.com:90/?pv.png HTTP/1.0 200 589
213.226.83.21 - - [21/Dec/2005:14:40:27 -0800] GET 
http://www.ccet-server.com/cgi-bin/ip.cgi HTTP/1.0 404 933
212.30.78.125 - - [21/Dec/2005:14:41:20 -0800] GET 
http://test.anonproxies.com/azenv.php?80 HTTP/1.0 404 935
203.88.51.59 - - [21/Dec/2005:14:42:07 -0800] GET 
http://www.abcseek.info/cgi-bin/ip1.cgi HTTP/1.0 404 933
213.156.221.126 - - [21/Dec/2005:14:42:29 -0800] POST 
http://66.96.85.136:80/checkp/env/env.php HTTP/1.0 404 932
218.71.245.157 - - [21/Dec/2005:14:42:51 -0800] GET 
http://umsky.com/prx.php HTTP/1.0 404 933
83.133.146.243 - - [21/Dec/2005:14:43:41 -0800] GET 
http://clickingagent.com/proxycheck.php?ip=66.92.14.218port=80loc= 
HTTP/1.1 404 940


-e-

Tino Wildenhain wrote:


Ed Colmar schrieb:
 


Hey All..

I'm following up on this thread after lots of different configuration
attempts, reinstalling apache2 from source, more configuration attempts,
banging my head against the wall, and endless troubleshooting.. 
Unfortuantely I am still failing to configure this correctly.


Thankfully the people using my apache as a open proxy are so relentless
I only need to start apache for a few seconds to determine if the proxy
is still open or not...

So...  I've made quite a bit of progress, but I am still at a loss to
understand what is going on here   Possibly this is a question for
the apache forum, but I figured some of my fellow zope users might be
able to help, since all I'm using apache for is to rewrite for zope, and
log access.

I have cleaned up my virtual host directive to only use a single Rewrite
Rule (which works):
RewriteRule ^/(.*)
http://192.168.1.32:8080/VirtualHostBase/http/www.myserver.net:80/myfolder/$1
[L,P]

Still the proxy was open and under attack.

   



I'm wondering where you get the impression you have an open proxy?
Given your configuration, no access can go outside your zope.

Sure people will try it all the time - but your apache still
delivers just your zope content.

Just try it out yourself!


 



___
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] apache open proxy configuration problem

2005-12-22 Thread Ed Colmar

Ok...  So these are failed attempts.

good good. 

The key factor for me getting the RewriteRule to work without using 
ProxyPass was to make apache run as user zope and group zope.  In case 
anyone else runs into a similar situation.


Thanks for all the help and guidance!

-e-

Martijn Pieters wrote:


On 12/22/05, Ed Colmar [EMAIL PROTECTED] wrote:
 


Well, my access log fills up with lines like:

61.54.11.222 - - [21/Dec/2005:14:36:56 -0800] GET
http://media.fastclick.net/w/get.media?sid=19765m=3tp=7d=sc=1
HTTP/1.1 404 927
   



Yeah so? They got a 404 response, a Not Found error. No proxying happening here!

--
Martijn Pieters
 



___
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] apache open proxy configuration problem

2005-12-22 Thread Ed Colmar


Hmm...

Ok the 404 thing I understand, but they are coming in at such a high 
rate it makes me nervous...  Maybe this is some form of distributed DOS 
attack?


On Closer inspection I do see some 200 codes in there as well, like:

69.70.140.130 - - [22/Dec/2005:13:40:59 -0800] CONNECT 
208.146.35.106:6667 HTTP/1.0 200 82
69.70.140.130 - - [22/Dec/2005:13:40:59 -0800] CONNECT 
208.146.35.106:6667 HTTP/1.0 200 82
69.70.140.130 - - [22/Dec/2005:13:40:59 -0800] CONNECT 
208.146.35.106:6667 HTTP/1.0 200 82
69.70.140.130 - - [22/Dec/2005:13:41:00 -0800] CONNECT 
208.146.35.106:6667 HTTP/1.0 200 82


Should I be worried about this one?

Thanks for the help again guys!

Maybe I should migrate this thread over to apache forum instead, since 
it does not really have much to do with zope...???


-e-

Tino Wildenhain wrote:


Ed Colmar schrieb:
 


Hey Tino

Well, my access log fills up with lines like:

61.54.11.222 - - [21/Dec/2005:14:36:56 -0800] GET
http://media.fastclick.net/w/get.media?sid=19765m=3tp=7d=sc=1
HTTP/1.1 404 927
   



404 is fine. We all have that in our logs. There is nothing to worry.
Its just the usual internet business.

See: http://www.faqs.org/rfcs/rfc2616.html

404 Not Found


 



___
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] apache open proxy configuration problem

2005-12-21 Thread Ed Colmar

Hey All..

I'm following up on this thread after lots of different configuration 
attempts, reinstalling apache2 from source, more configuration attempts, 
banging my head against the wall, and endless troubleshooting..  
Unfortuantely I am still failing to configure this correctly.


Thankfully the people using my apache as a open proxy are so relentless 
I only need to start apache for a few seconds to determine if the proxy 
is still open or not...


So...  I've made quite a bit of progress, but I am still at a loss to 
understand what is going on here   Possibly this is a question for 
the apache forum, but I figured some of my fellow zope users might be 
able to help, since all I'm using apache for is to rewrite for zope, and 
log access.


I have cleaned up my virtual host directive to only use a single Rewrite 
Rule (which works):
RewriteRule ^/(.*) 
http://192.168.1.32:8080/VirtualHostBase/http/www.myserver.net:80/myfolder/$1 
[L,P]


Still the proxy was open and under attack.

I turned off mod_proxy and related proxy modules...  But...  The P flag 
in the RewriteRule uses the proxy module though, so the rewrite did not 
work.


I tried removing the P flag, and it does redirect to the appropriate 
page, but does not rewrite the URL correctly.


I have tried using all of the following (inside the virtualhost 
directive, outside of it, and both) to disable the open proxy...  none 
of which have any effect:


Directory proxy:*
Order Deny,Allow
Deny from all
Allow from www.myserver.net
/Directory

ProxyRequests Off

I attempted to use

ProxyBlock *

Which was effective, but also killed the rewrite rule.

Can anyone offer me a decisive way to kill off this open proxy?

I'm getting so frustrated with it I'm considering just ditching apache 
entirely and running zope on port 80.  of course this would mean no 
virtual hosts, but I can live with that in this case.


Please help!

Thanks!

-ed

Kanealii, Priam Mr KRS wrote:


I abandoned mod_proxy for mod_rewrite. Security-wise, mod_rewrite had
less to worry about (this is important when website administration
changes hands).

The sample configuration below shows how to handle Zope resource
quirks and how to proxy requests to and from folders in Zope (both
tested). The last rule is my guess at what proxy everything to and
from Zope would look like (untested). Apache is listening on 80 and
routes requests to a Zope instance listening on 8080.

IfModule mod_rewrite.c

RewriteEngine On
RewriteLog /path/to/rewrite_log

# Zope serves some system-ish content from p_ and misc_.
RewriteRule ^/p_(.*)
http://127.0.0.1:8080/VirtualHostBase/http/%{HTTP_HOST}/VirtualHostRoot/p_$1 
[L,P]
RewriteRule ^/misc_(.*) 
http://127.0.0.1:8080/VirtualHostBase/http/%{HTTP_HOST}/VirtualHostRoot/misc_$1 
[L,P]


# Apache folders served by Zope folders.
RewriteRule ^/folder1(.*) 
http://127.0.0.1:8080/VirtualHostBase/http/%{HTTP_HOST}/VirtualHostRoot/folder1$1 
[L,P]
RewriteRule ^/folder2(.*) 
http://127.0.0.1:8080/VirtualHostBase/http/%{HTTP_HOST}/VirtualHostRoot/folder2$1 
[L,P]


# Push everything to Zope?
RewriteRule ^(.*) 
http://127.0.0.1:8080/VirtualHostBase/http/%{HTTP_HOST}/VirtualHostRoot/$1 
[L,P]


/IfModule

Aloha,
Priam

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf 
Of Ed Colmar

Sent: Saturday, October 15, 2005 9:19 AM
To: zope@zope.org
Subject: [Zope] apache open proxy configuration problem

I've been running zope through apache for years and years now, and I
have a new machine set up with apache 2.0.48 and zope (Zope 2.8.0-final,
python 2.3.5, linux2)

Using Identical Vhost configuration settings from an old machine all has
been well, up until about 5 days ago, when I noticed the machine getting
slammed, and wierd logs started showing up like:

xxx.xxx.xxx.xxx - - [14/Oct/2005:14:09:06 -0700] GET
http://partners.mygeek.com:80/search.jsp?partnerid=98885pagesize=12 
http://partners.mygeek.com:80/search.jsp?partnerid=98885pagesize=12

HTTP/1.1 403 406

(IP removed to protect the guilty)

In my quick research to try to determine the problem, I found people
advising to turn ProxyRequests Off, which I did, but did not have any
effect.

Luckily this is just a development server, not a live production server,
so its not super critical, but I'm nervous now that my production server
might be in the same state...

Here is a sample vhost.conf entry:

NameVirtualHost 192.168.1.32
VirtualHost 192.168.1.32
ServerName www.greengraphics.net
ServerPath /var/www/greengraphics/www
DocumentRoot /var/www/greengraphics/www
ServerAdmin webmaster
RewriteEngine On
TransferLog logs/Vhost-greengraphics-access.log
ProxyRequests Off
Proxy *
Order deny,allow
Allow from all
/Proxy
ProxyPass /
http://192.168.1.32:8080/VirtualHostBase/http/www.greengraphics.net:80/greengraphics/VirtualHostRoot/ 


ProxyPassReverse /
http://192.168.1.32:8080/VirtualHostBase/http

[Zope] ZSQL batching with dtml-in

2005-12-08 Thread Ed Colmar
Do ZSQL methods communicate with the dtml-in call and understand the 
size attribute?


for example, in this dtml-in statement:
dtml-in SQL_get_large_list size=20 start=query_start
/dtml-in

Will the database be queried for all results, and only have 20 
displayed, or will the database just return the 20 that are needed?


Thanks for the insight!

-Ed
___
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] Human validation in zope/python

2005-12-07 Thread Ed Colmar

Hey All

I'm wondering if anyone has a module that will generate the randomized 
images that are so common these days in registration forms to verify 
that the user is a human.  Or, alternativly, other strategies to block 
spamming of registration forms by bots or other automated methods.


Thanks!
Ed


___
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] apache open proxy configuration problem

2005-10-14 Thread Ed Colmar
I've been running zope through apache for years and years now, and I 
have a new machine set up with apache 2.0.48 and zope (Zope 2.8.0-final, 
python 2.3.5, linux2)


Using Identical Vhost configuration settings from an old machine all has 
been well, up until about 5 days ago, when I noticed the machine getting 
slammed, and wierd logs started showing up like:


xxx.xxx.xxx.xxx - - [14/Oct/2005:14:09:06 -0700] GET 
http://partners.mygeek.com:80/search.jsp?partnerid=98885pagesize=12 
HTTP/1.1 403 406


(IP removed to protect the guilty)

In my quick research to try to determine the problem, I found people 
advising to turn ProxyRequests Off, which I did, but did not have any 
effect.


Luckily this is just a development server, not a live production server, 
so its not super critical, but I'm nervous now that my production server 
might be in the same state...


Here is a sample vhost.conf entry:

NameVirtualHost 192.168.1.32
VirtualHost 192.168.1.32
ServerName www.greengraphics.net
ServerPath /var/www/greengraphics/www
DocumentRoot /var/www/greengraphics/www
ServerAdmin webmaster
RewriteEngine On
TransferLog logs/Vhost-greengraphics-access.log
ProxyRequests Off
   Proxy *
   Order deny,allow
   Allow from all
   /Proxy
ProxyPass / 
http://192.168.1.32:8080/VirtualHostBase/http/www.greengraphics.net:80/greengraphics/VirtualHostRoot/
ProxyPassReverse / 
http://192.168.1.32:8080/VirtualHostBase/http/www.greengraphics.net:80/greengraphics/VirtualHostRoot/

/VirtualHost



mod_proxy.conf looks like:




IfDefine HAVE_PROXY
 IfModule !mod_proxy.c
   LoadModule proxy_module modules/mod_proxy.so
   #LoadModule proxy_connect_modulemodules/mod_proxy_connect.so
   #LoadModule proxy_ftp_modulemodules/mod_proxy_ftp.so
   LoadModule proxy_http_modulemodules/mod_proxy_http.so
 /IfModule
/IfDefine

IfModule mod_proxy.c

#
# Proxy Server directives. Uncomment the following lines to
# enable the proxy server:
#

ProxyRequests Off

Proxy *
   Order deny,allow
   Deny from all
#Allow from .your-domain.com
/Proxy

#
# Enable/disable the handling of HTTP/1.1 Via: headers.
# (Full adds the server version; Block removes all outgoing Via: 
headers)

# Set to one of: Off | On | Full | Block
#

ProxyVia On

# End of proxy directives.

/IfModule


any suggestions?  places to look to verify security?

Thanks!

-ed
___
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] php header() equivalent in zope, translation please

2005-09-06 Thread Ed Colmar

I'm working on a website to be viewed in the eve-online in-game browser.

This browser has a feature called trusted site that allows the server 
to extract information about the game character that is viewing the 
page... Once the website is trusted all of the variables are 
transferred over in the header section of the http request... My 
question relates to how to request this trusted status...


They have provided a sample php script that has this behaviour, but I am 
very unfamiliar with php, and would be interested to see what the 
zope/python equivalent would be...


Could anyone give me a translation for this line  
header(eve.trustme: ...


TIA!

-e-


|?
ini_alter(session.use_cookies,1);
ob_start();
?
HTML
HEAD
TITLETestpage/TITLE
/HEAD
BODY
?
if (!(strpos($HTTP_USER_AGENT,EVE-minibrowser)===false))
{
if ($HTTP_SERVER_VARS[HTTP_EVE_TRUSTED]==no)
{
header(|eve.trustme:|http://www.mywebsite.net/::please| allow me to 
access your pilot information.|);

}
else
{
?
bPilot:/b
? echo |$HTTP_SERVER_VARS[“|HTTP_EVE_CHARNAME”]; ?
bLocation:/b
? echo |$HTTP_SERVER_VARS[“|HTTP_EVE_REGIONNAME”]; ?/?
echo $|HTTP_SERVER_VARS[“|HTTP_EVE_CONSTELLATIONNAME”]; ?/?
echo |$HTTP_SERVER_VARS[“|HTTP_EVE_SOLARSYSTEMNAME”]; ?BR
?
if (|$HTTP_SERVER_VARS[“|HTTP_EVE_STATIONNAME”] != None)
{
?
bStation:/b ? echo |$HTTP_SERVER_VARS[“|HTTP_EVE_STATIONNAME”]; ?br
?
}
}
}
?
/BODY
/HTML
?
ob_end_flush();
?|
___
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] zope 2.8 command line tracebacks

2005-08-29 Thread Ed Colmar
The 2.8 version of zope no longer displays tracebacks in the terminal 
window (after excecuting ./runzope). It just stops execution at any 
errors.  I am trying to troubleshoot a page that is called from another 
server, so I do not get to view the error document.


I have debug mode turned on. 

Is there any way I can get this information?  It is ok if it ends up in 
a logfile, but output to shell (like previous zope behaviour) is preferred.


I am linux (x86) using a zope built from sources.

Thanks for any tips.

-e
___
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] paypal IPN. Debug messages missing. Script goes zombie

2005-07-06 Thread Ed Colmar

Hi all!

I've been hacking together a few seperate paypal IPN connections, some 
code from basion, and some from random web scrapings...  Anyway...  
Things are working for the most part, except that this method for some 
reason dies when using urllib.urlopen(), and what is really wierd is 
that I get no error message, it just hangs.


I am running an older version of zope, but I have never seen this 
behaviour before.  The debug (-D) flag is set in start.


here is the code I am using...  As far as I can tell my syntax is 
proper...  ???


   def 
paypal_notify(self,address_street='',address_zip='',first_name='',last_name='',payer_business_name='',payer_email='',
   
payer_id='',payer_status='',residence_country='',quantity='',receiver_email='',receiver_id='',custom='',invoice='',

   memo='',auth_id='',auth_exp='',auth_amount='',auth_status='',
   remaining_settle='',
   mc_gross_x='',mc_handling_x='',mc_shipping_x='',
   
num_cart_items='',parent_txn_id='',payment_date='',payment_status='',payment_type='',
   
pending_reason='',reason_code='',txn_id='',txn_type='',exchange_rate='',mc_currency='',mc_fee='',
   mc_gross='', 
mc_handling='',payment_gross='',settle_amount='',settle_currency='',
   
auction_buyer_id='',auction_closing_date='',auction_multi_item='',for_auction='',
   
option_name1='',option_name2='',option_selection1='',option_selection2='',tax='',
   
subscr_date='',subscr_effective='',period1='',period2='',period3='',amount1='',
   
amount2='',amount3='',mc_amount1='',mc_amount2='',mc_amount3='',recurring='',
   reattempt='',retry_at='', 
recur_times='',username='',password='',subscr_id='',test_ipn=0,REQUEST=None):

take a IPN from paypal, and update the database 
   print Initiating paypal IPN
   # they want us to send back their same shite (and we've just nicely
   # deblocked it from the REQUEST...)
   print DEBUG = STARTING
   requestform = REQUEST.form
   print requestform['quantity'] # debug test
   requestform['cmd'] = '_notify-validate'
   print DEBUG = INSERTED NEW VALUE
   print requestform
   print sending request back to paypal
   requestparams = urllib.urlencode(requestform)
   print DEBUG = Encoded Request
   print requestparams
   data = 
urllib.urlopen('https://www.sandbox.paypal.com/cgi-bin/webscr',  
requestform)

   print DEBUG = urlretrieved
   print data.read()
   print DEBUG = DATA READ

--

I see all my debug print commands until encoded Request and 
requestparams, so it is getting lost on the urlopen call.


Thanks for any help or tips.  I'll post the final IPN method when I'm done.

Cheers!

-ed
___
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] Simple paypal IPN external method or product

2005-06-23 Thread Ed Colmar
I found the Bastion Ledger and Bastion Paypal connection, but it is way 
way overkill for what I want to do. 


Does anyone have a simple(r) IPN script they can point me towards?

TIA!

-e-
___
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] Py-Toc and zope products

2005-06-09 Thread Ed Colmar

Greetings.

I have been messing around with the py-TOC code, and am looking forward 
to implementing it into my zope/MySQL site.


I think I am missing something about how to connect it to my zope folder 
class


My goal with this is to tie in the AIM messages in with the folder class 
I am using in zope to affect database queries.  However, I've only been 
able to successfully get it running using the bot and bm classes as 
global variables (not self.bot and self.bm) so they are now outside the 
class where I need them... 

This was my best attempt at getting them inside the zope folder class, 
but zope does not like it...  Is there a better way?


class SystemofControlSite(Folder):
   def __init__(self, id, title, content):
   self.bot = MyBot(syscontrolbot23,pass)
   self.bot._info = www.systemofcontrol.com notification bot.
   self.bm = BotManager()
   self.bm.addBot(self.bot,myBot) # start it up
   time.sleep(1)

on init, I get this error:

*UnpickleableError*

Sorry, a site error occurred.

Traceback (innermost last):

   * Module ZPublisher.Publish, line 150, in publish_module
   * Module Products.PlacelessTranslationService.PatchStringIO, line
 51, in new_publish
   * Module ZPublisher.Publish, line 114, in publish
   * Module Zope, line 171, in zpublisher_exception_hook
   * Module ZPublisher.Publish, line 102, in publish
   * Module Zope, line 188, in commit
   * Module ZODB.Transaction, line 222, in commit
   * Module ZODB.Transaction, line 195, in commit
   * Module ZODB.Transaction, line 256, in _commit_objects
   * Module ZODB.Connection, line 387, in commit
 __traceback_info__:
 (('Products.SystemofControlSite.SystemofControlSite',
 'SystemofControlSite'), '\x00\x00\x00\x00\x00\x00\xdd1', '')

UnpickleableError: Cannot pickle type 'file' objects (Also, an error 
occurred while attempting to render the standard error message.)


I'm assuming this is because zope is attempting to make the bot 
connection persistant...



so then I did:

bot = MyBot(syscontrolbot23,pass)
bm = BotManager()
bm.addBot(bot,myBot) # start it up


and use global variables to control it. 
   def initbot(self):

create the bot  
   global bot
   global bm
   bm.addBot(bot,myBot) # start it up
   time.sleep(1)
   return 1

This sucks though becasue I cannot pass a message from AIM back into my 
zope product to do something with the database...


Any ideas?  Suggestions?

Cheers!

-ed
___
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-dev] dynamically using inheritance

2002-02-04 Thread Ed Colmar


Thanks for the reply.  

I tried this out, and I'm getting a key error:

Hmmm...  Any other suggestions?  Should I specify with PARENTS first?


Thanks again!

-e-


Site Error
An error was encountered while publishing this resource. 

KeyError

Sorry, a site error occurred.

Traceback (innermost last):
  File /usr/local/dc/zope/lib/python/ZPublisher/Publish.py, line 223, in 
publish_module
  File /usr/local/dc/zope/lib/python/ZPublisher/Publish.py, line 187, in 
publish
  File /usr/local/dc/zope/lib/python/Zope/__init__.py, line 226, in 
zpublisher_exception_hook
(Object: dev_site)
  File /usr/local/dc/zope/lib/python/ZPublisher/Publish.py, line 171, in 
publish
  File /usr/local/dc/zope/lib/python/ZPublisher/mapply.py, line 160, in 
mapply
(Object: index_html)
  File /usr/local/dc/zope/lib/python/ZPublisher/Publish.py, line 112, in 
call_object
(Object: index_html)
  File /usr/local/dc/zope/lib/python/OFS/DTMLDocument.py, line 199, in 
__call__
(Object: index_html)
  File /usr/local/dc/zope/lib/python/DocumentTemplate/DT_String.py, line 
546, in __call__
(Object: index_html)
  File /usr/local/dc/zope/lib/python/DocumentTemplate/DT_With.py, line 
133, in render
(Object: _[skinname])
  File /usr/local/dc/zope/lib/python/DocumentTemplate/DT_Util.py, line 
231, in eval
(Object: _[skinname])
(Info: _)
  File string, line 2, in f
(Object: guarded_getitem)
  File /usr/local/dc/zope/lib/python/AccessControl/DTML.py, line 104, in 
guarded_getitem
(Object: index_html)
  File /usr/local/dc/zope/lib/python/AccessControl/ZopeGuards.py, line 
151, in guarded_getitem
KeyError: skins.default




On Mon, 4 Feb 2002, R. David Murray wrote:

 On Sat, 2 Feb 2002, Ed Colmar wrote:
  dtml-call REQUEST.set('skinname', 'skins.default')
  dtml-with _.string(skinname)
 
 This is a [EMAIL PROTECTED] question rather than a zope-dev
 question, but:
 
 dtml-with _[skinname]
 
 should solve your problem.  That looks the string held in
 skinname up in the namespace and passes it to dtml-with.
 
 --RDM
 
 
 ___
 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-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-dev] dynamically using inheritance

2002-02-02 Thread Ed Colmar


Hey all. 

I'm working ona little skinning implementation where I want to pull a 
folder name out of a database, then navigate to it to get dtml methods.

Hardcoding it is easy, but how exactly would I insert a variable into this 
simple dtml-with?

dtml-with skins.default
dtml-var standard_skin_appearance
/dtml-with

to get an idea of how the site is layed out, here's where the skins 
and inside data would live:

www.mysite.com:8080/skins/default/standard_skin_appearance

I tried variations on:

dtml-call REQUEST.set('skinname', 'skins.default')
dtml-with _.string(skinname)

with no luck...  

In the docs, I'm seeingt that it shoulod be possible with the right 
syntax.  What would that be?

Thanks so much!

-ed-


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



Re: [Zope-dev] Dynpersist.so and makefile.pre.in

2002-01-31 Thread Ed Colmar

Huh...

I found a makefile.pre.in, but I'm seeing tons of errors on make

There was some note in the Zpatterns docs that after zope2.2 the dynpersist
woudn't be neccesary anymore.  Is this true?

Are there any other (simple) solutions to doing authentication through a SQL
DB?  Jumping through hoops to get Zpatterns working seems silly when all I
need is basic authentication.  Though it would probably make my life easier
once I figure it out.

Anyways...  Thanks for the assistance!

-ed-

- Original Message -
From: R. David Murray [EMAIL PROTECTED]
To: Christian Theune [EMAIL PROTECTED]
Cc: Ed Colmar [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, January 31, 2002 9:05 AM
Subject: Re: [Zope-dev] Dynpersist.so and makefile.pre.in


 On Thu, 31 Jan 2002, Christian Theune wrote:
  On my systems it is located at somewhere like
 
  /usr/lib/python(version)/config/Makefile.pre.in
  or
  /usr/local/lib/python(version)/config/Makefile.pre.in

 Just an FYI, Makefile.pre.in no longer exists (as far as I can
 tell) under python 2.2.

 --RDM


 ___
 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-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-dev] Dynpersist.so and makefile.pre.in

2002-01-30 Thread Ed Colmar

Hey!

I know I've done this before, but for some reason it's eluding me.  

I'm on a brand new box with a fresh 2.4.3 zope.

I am trying to get sql authentication working with loginmanager/Zpatterns

I can't seem to find a makefile.pre.in on my system.  I have python and 
python-devel both from RPM, and a regular install of zope.

I tried using a makfile.pre.in from some other package (found on the web) 
but got tons of errors.  

Where would I find a copy of this file for my platform?  Which 
incedentally is Mandrake 8.1.  Anyone have one that might work.  Do I need 
to build python from the source?

Thanks!

-ed-


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



Re: [Zope] Re: [Image-SIG] Properly integrating PIL, reportlab, and zope

2000-11-09 Thread ed colmar


Ahha!

To force zope (and reportlab) to use a different working directory, use:

import os
os.chdir('/usr/local/zope/differentdir/')

still this is a pretty big workaround, but hey...  It works!

-e-


 Hello ed,

 If you figure this out let me know. We tried several times and were
 unsuccessful. we only have two files (logos) so it wasn't worth fighting
 with.

 thanks,

 Dan


 ed colmar wrote:
 
  Thanks for the help everyone!
 
  I'm a few steps closer to solving this one.  What I'm doing is pretty
much a
  workaround, since I can't figure out how to pass a image file directly
from
  within the zodb.  I have created a seperate field that gets passed to a
  localFS directory.
 
  Right now, I just need to refrence a file that is somewhere other than
the
  /usr/local/zope directory.
 
  I've been trying:
  c.drawInlineImage(str('/home/zope/uploadedimages/' + filename), .5*inch,
  10.*inch,4*inch)
 
  for some reason it can't find a file anywhere other than the base
directory
  in zope.  I cannot use this directory because it will serve as a
collection
  of image files.
 
  Any ideas how to force it to look somewhere else for this file?
 
  Thanks again!
 
  -e-
 
  - Original Message -
  From: "Daniel Rusch" [EMAIL PROTECTED]
   I have no idea if this will help you. We use PIL, reportlabs and zope
to
   create P.O.'s, to place a logo on the page we use the following line
of
   code:
  
   c.drawInlineImage("gclogo_color.gif", .5*inch, 10.*inch,4*inch)
  
 
  ___
  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] Re: [Image-SIG] Properly integrating PIL, reportlab, and zope

2000-11-08 Thread ed colmar


Thanks for the help everyone!

I'm a few steps closer to solving this one.  What I'm doing is pretty much a
workaround, since I can't figure out how to pass a image file directly from
within the zodb.  I have created a seperate field that gets passed to a
localFS directory.

Right now, I just need to refrence a file that is somewhere other than the
/usr/local/zope directory.

I've been trying:
c.drawInlineImage(str('/home/zope/uploadedimages/' + filename), .5*inch,
10.*inch,4*inch)

for some reason it can't find a file anywhere other than the base directory
in zope.  I cannot use this directory because it will serve as a collection
of image files.

Any ideas how to force it to look somewhere else for this file?

Thanks again!

-e-



- Original Message -
From: "Daniel Rusch" [EMAIL PROTECTED]
 I have no idea if this will help you. We use PIL, reportlabs and zope to
 create P.O.'s, to place a logo on the page we use the following line of
 code:

 c.drawInlineImage("gclogo_color.gif", .5*inch, 10.*inch,4*inch)



___
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] Properly intergating reportlab and Zope

2000-11-06 Thread ed colmar

Hi all!

I'm still trying to get this to work, so I'm going to try the lists for
assistance again.  TIA!!!

I am working on a project using zope and reportlab.

The goal is to have uploaded images end up in a formatted PDF file.

I have both of these halves completed, I need to figure out how to connect
them.

I have been using SquishFile.py as the wrapper around uploaded images, as is
done in squishdot.  The few image types I have tried have displayed fine on
screen, but PIL/Reportlab is not able to recognise the image.  I know how to
get an image into reportlab from the filesystem, but is there a way to use
one that is in the Zodb?

How would you go about wrapping the file in a PIL.Image() ?  I've been
trying things similar to:

cardimage=PIL.Image.open(self.uploadedimage)
c.drawInlineImage(cardimage, 1,1)

This gives an error in reportlab.canvas.convert()

I tried using PIL.image.fromstring(), but I can't quite get it to work
out:

filebytes=[str(self.uploadedimage.file_bytes()), 'bytes']
cardimage=PIL.Image.fromstring(self.uploadedimage.content_type(),
   filebytes,
   self.uploadedimage.file_data())
c.drawInlineImage(cardimage, 1,1)

This gives a typeerror: PIL/Image.py, line 848, in new

has anyone succesfully done this?  can I just Leave the SquishFile wrapper
off if it is ONLY going to be images that get uploaded?

Thanks for any ideas!

-ed-


___
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] UserDb - Please just WORK

2000-10-18 Thread ed colmar

Since Login Manager isn't doing the trick, I've been trying User DB to
authenticate to my postgresql DB.

I get some strange errors, like when I try to view a page that is
'protected' by UserDb, I get the error message below.  Also, when I click a
user in the management screen, it says "the specified user does not exist".

Arrggg this task is so simple but REALLY FRUSTRATING...

Thank you, thank you, thank you...  (to anyone who can help)

Error Type: TypeError
Error Value: argument 1: expected read-only character buffer, None found

Traceback (innermost last):
  File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 222, in
publish_module
  File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 187, in
publish
  File /usr/local/zope/lib/python/Zope/__init__.py, line 221, in
zpublisher_exception_hook
(Object: Traversable)
  File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 162, in
publish
  File /usr/local/zope/lib/python/ZPublisher/BaseRequest.py, line 440, in
traverse
  File /usr/local/zope/lib/python/Products/UserDb/UserDb.py, line 310, in
validate
(Object: RoleManager)
  File /usr/local/zope/lib/python/AccessControl/User.py, line 437, in
validate
(Object: RoleManager)
  File /usr/local/zope/lib/python/Products/UserDb/UserDb.py, line 147, in
getUsers
(Object: RoleManager)
  File /usr/local/zope/lib/python/Products/UserDb/UserDb.py, line 52, in
__init__
TypeError: (see above)




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

2000-10-16 Thread ed colmar

Thanks for the tips everyone!

I keep going between UserDb and LoginManager to try to get this to work.
UserDb gives me weird errors, and isn't really current, so I'm focusing on
LM.

I feel like I'm getting closer to a solution, but I'm still having
difficuties...

I followed jPenny's how to regarding accessing SQL method variables from
within python, and wrapped the retrieveItem result in a User Class.  It
seems like it is at least running my code now, but no authentication...

Am I close?  Can Anyone working with LoginManager offer any insight into
this?

Thanks!

-e-

Here's the code I have in UserSources.py

class User(BasicUser):
"""  A wrapper for the basic user class """
icon='misc_/UserDb/User_icon'

def __init__(self, name, password, roles, domains):
self.name   =name
self.__ =password
self.roles  =filter(None, map(strip, split(roles, ',')))
self.domains=filter(None, map(strip, split(domains, ',')))

def getUserName(self):
return self.name

def _getPassword(self):
return self.__

def getRoles(self):
return self.roles

def getDomains(self):
return self.domains



class PGCryptUserSource(BasicUserSource):
"""  A sql based encrypted user source """
meta_type="PG Crypt User Source"
__plugin_kind__="User Source"

def retrieveItem(self, name):
try: res=self.getuserbyusername(username=name)
except: return None

fields2index={}
fieldnames=res._schema.items()

for i in range(len(fieldnames)):
fields2index[fieldnames[i][0]]=fieldnames[i][1]

username=res[0][fields2index['username']]
password=res[0][fields2index['password']]
roles=res[0][fields2index['roles']]
domains=res[0][fields2index['domains']]

return User(username, password, roles, domains)


def rolesForUser(self, user):
name = user.getUserName()
res = self.getuserbyusername(username=name)
fields2index={}
fieldnames=res._schema.items()
for i in range(len(fieldnames)):
fields2index[fieldnames[i][0]]=fieldnames[i][1]
roles=res[0][fields2index['roles']]
return roles

def domainsForUser(self, user):
name = user.getUserName()
res = self.getuserbyusername(username=name)
fields2index={}
fieldnames=res._schema.items()
for i in range(len(fieldnames)):
fields2index[fieldnames[i][0]]=fieldnames[i][1]
domains=res[0][fields2index['domains']]
return domains

def authenticateUser(self, user, password, request):
name = user.getUserName()
res = self.getuserbyusername(username=name)
fields2index={}
fieldnames=res._schema.items()
for i in range(len(fieldnames)):
fields2index[fieldnames[i][0]]=fieldnames[i][1]
passwd=res[0][fields2index['password']]
if crypt.crypt(password,'ab')==passwd:
return 1
else:
return 0




Here's one of the tracebacks that I get:

Error Type: TypeError
Error Value: argument 1: expected read-only character buffer, None found

Traceback (innermost last): File
/usr/local/zope/lib/python/ZPublisher/Publish.py, line 222, in
publish_module
File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 187, in publish
File /usr/local/zope/lib/python/Zope/__init__.py, line 221, in
zpublisher_exception_hook (Object: Traversable)
File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 162, in publish
File /usr/local/zope/lib/python/ZPublisher/BaseRequest.py, line 440, in
traverse
File /usr/local/zope/lib/python/Products/LoginManager/LoginManager.py, line
108, in validate (Object: ProviderContainer)
File /usr/local/zope/lib/python/Products/LoginManager/LoginMethods.py, line
235, in findLogin (Object: PlugInBase)
File /usr/local/zope/lib/python/Products/LoginManager/LoginManager.py, line
65, in getItem (Object: ProviderContainer)
File /usr/local/zope/lib/python/Products/ZPatterns/Rack.py, line 60, in
getItem (Object: ProviderContainer)
File /usr/local/zope/lib/python/Products/LoginManager/UserSources.py, line
522, in retrieveItem (Object: ProviderContainer)
File /usr/local/zope/lib/python/Products/LoginManager/UserSources.py, line
485, in __init__ TypeError: (see above)


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

2000-10-13 Thread ed colmar


Has anyone been able to use LoginManager with a SQL db?  with or without
encryption?

I'm still baffled by this how-to:
http://www.zope.org/Members/jok/SQL_based_LoginManager

In this example, there are dtml-methods that do the work of the UserSource,
but there is no retrieveItem?

I would really love to get this working instead of having to revert back to
older depreciated products.

Thanks for any help!

-e-

From: "Aleksander Salwa" [EMAIL PROTECTED]

 I remember I had some troubles trying to put methods rolesForUser,
 domainsForUser, authenticateUser in UserSource class. They can be moved to
 user class. I did so.
 But your case is harder then mine, cause you don't have objects
 representing users in ZODB. Maybe there are problems with retrieveItem
 method ?
 Maybe you should build wrapper class around your database
 data - something like "pluggable brains" ?
 I have no more ideas :(



___
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] LoginManager - how does it work?

2000-10-10 Thread ed colmar

Thanks for the help!  Still looking for that HOWTO.txt

So, now I have a UserSource Installed into my LoginManager.   It is called
"pgcrypt" and is supposed to authenticate to a SQL database.  The password
stored in the DB is encryputed using the same scheme.  Any ideas why it
doesn't let me in?  Is there any way to troubleshoot this?  It seems like
there should be a way to tell if it's going to work or not form the
management interface.

Here's what I added to UserSources.py:


class PGCryptUserSource(BasicUserSource):
"""  A sql based encrypted user source """
meta_type="PG Crypt User Source"
__plugin_kind__="User Source"

def retrieveItem(self, name):
self.getcustbyusername(username=name)

def rolesForUser(self, user):
name = user.getUserName()
res = self.getcustbyusername(username=name)
fields2index={}
fieldnames=res._schema.items()
for i in range(len(fieldnames)):
fields2index[fieldnames[i][0]]=fieldnames[i][1]
roles=res[0][fields2index['roles']]
return roles

def domainsForUser(self, user):
name = user.getUserName()
res = self.getcustbyusername(username=name)
fields2index={}
fieldnames=res._schema.items()
for i in range(len(fieldnames)):
fields2index[fieldnames[i][0]]=fieldnames[i][1]
domains=res[0][fields2index['domains']]
return domains

def authenticateUser(self, user, password, request):
name = user.getUserName()
res = self.getcustbyusername(username=name)
fields2index={}
fieldnames=res._schema.items()
for i in range(len(fieldnames)):
fields2index[fieldnames[i][0]]=fieldnames[i][1]
passwd=res[0][fields2index['password']]
if crypt.crypt(password,'ab')==passwd:
return 1
else:
return 0




+

context.registerPlugInClass(
PGCryptUserSource,
permission = 'Add PGCrypt UserSource',
constructors = defaultConstructors(PGCryptUserSource,globals()),
)




___
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] LoginManager - how does it work?

2000-10-07 Thread ed colmar



I've managed to get loginManager to install, but I 
am very confused as to what to do with it.

I've read the how-tos on zope.org, and the 
documentation of LoginManager itself... But I still don't understand what 
is supposed to happen.

A User Source is a location to find users, Say, my 
SQL database, right?

How do I tell it to use the SQL methods I have for 
retrieveing passwords?

The how-tos say to create dtml-methods called 
"userAuthenticate" "userExists" and "userRoles". Where do these go? 


Can anyone help me see the light on 
this?

Thank you




[Zope] LoginManager Error

2000-10-03 Thread Ed Colmar



Hi!

I'm getting a type error when I try to add a LoginManager to 
a folder.  Any sugestions on how to get past this?

My config:

Zope 2.2.1
ZPatterns 0.3.0
LoginManager 0.8.6

The traceback:

Error Type: TypeError
Error Value: keyword parameter redefined


Traceback (innermost last):
   File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 222, in 
publish_module
   File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 187, in publish
   File /usr/local/zope/lib/python/Zope/__init__.py, line 221, in 
zpublisher_exception_hook
   File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 171, in publish
   File /usr/local/zope/lib/python/ZPublisher/mapply.py, line 160, in mapply
 (Object: manage_addLoginManager)
   File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 112, in 
call_object
 (Object: manage_addLoginManager)
   File 
/usr/local/zope/lib/python/Products/LoginManager/LoginManager.py, 
line 237, in manage_addLoginManager
   File /usr/local/zope/lib/python/Products/ZPatterns/PlugIns.py, line 
313, in _constructPlugIn
TypeError: (see above)

___
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] UserDB plus crypt

2000-10-03 Thread Ed Colmar

Since I couldn't get LoginManger to work, I started modifying 
UserDb to handle encrypted passwords...  I've changed it so the 
encrypted password is stored in the DB, but I haven't been able to 
get it to authenticate.

Can anyone offer any insight as to what I need to do?

My modified UserDb.py is attached.

Thanks!

-ed-

"""User Db product

This product provides support for User Folder-like objects that
store data in back-end databases.


CREATE TABLE users (
username varchar(255) NOT NULL,
password varchar(255) NOT NULL,
domains varchar(255),
roles varchar(255)
);


"""

__version__='$Revision: 1.13 $'[11:-2]

import Globals, App.Undo, socket, regex
from Products.ZSQLMethods.SQL import SQL
from Globals import PersistentMapping
from Globals import Persistent
from Globals import HTMLFile, MessageDialog
from string import join,strip,split,lower
from App.Management import Navigation, Tabs
from Acquisition import Implicit
from OFS.SimpleItem import Item
from OFS.Document import Document
from base64 import decodestring, encodestring
from urllib import quote, unquote
from ImageFile import ImageFile
from AccessControl.Role import RoleManager
from AccessControl.User import BasicUser, BasicUserFolder
from string import split, join, upper, lower

## Crypt toolkit ##
import crypt, random

ListType=type([])




class User(BasicUser):

 icon='misc_/UserDb/User_icon'

 def __init__(self, name, password, roles, domains):
 self.name   =name
 self.__ =password
 self.roles  =filter(None, map(strip, split(roles, ',')))
 self.domains=filter(None, map(strip, split(domains, ',')))

 def getUserName(self):
 return self.name

 def _getPassword(self):
 return self.__

 def getRoles(self):
 return self.roles

 def getDomains(self):
 return self.domains






class UserDb(BasicUserFolder):
 """ """

 meta_type='User Db'
 id   ='acl_users'
 title='User Db'
 icon ='misc_/UserDb/UserDb_icon'

 isPrincipiaFolderish=1
 isAUserFolder=1
 encryptedpasswords=1

 manage_options=(
 {'label':'Contents',   'action':'manage_main'},
 {'label':'Properties', 'action':'manage_properties'},
 {'label':'Security',   'action':'manage_access'},
 {'label':'Undo',   'action':'manage_UndoForm'},
 )

 __ac_permissions__=(
 ('View management screens',
  ['manage','manage_menu','manage_main','manage_copyright', 'manage_tabs',
   'manage_properties', 'manage_UndoForm']),
 ('Undo changes',   ['manage_undo_transactions']),
 ('Change permissions', ['manage_access']),
 ('Manage users',   ['manage_users']),
 ('Change User Dbs', ['manage_edit']),
 )

 manage_properties=HTMLFile('properties', globals())

 def __init__(self, conn_id, cookie_mode=0):
 self.conn_id=conn_id
 self.cookie_mode=cookie_mode

 self.docLogin =Document(_docLogin, __name__='docLogin')
 self.docLogout=Document(_docLogout, __name__='docLogout')
 self.docLogin.__roles__=None
 self.docLogout.__roles__=None

 self.sqlListQuery=SQL('sqlListQuery', '', conn_id,
   '',
   _sqlListQuery)
 self.sqlUserQuery=SQL('sqlUserQuery', '', conn_id,
   'username',
   _sqlUserQuery)
 self.sqlAddQuery=SQL('sqlAddQuery', '', conn_id,
  'username password domains roles',
   _sqlAddQuery)
 self.sqlEditQuery=SQL('sqlEditQuery', '', conn_id,
   'username password domains roles',
   _sqlEditQuery)
 self.sqlDelQuery=SQL('sqlDelQuery', '', conn_id,
  'username',
   _sqlDelQuery)


 def getUserNames(self):
 """Returns a list of user names or [] if no users exist"""
 data=[]
 try:items=self.sqlListQuery()
 except: return data
 for ob in items:
 data.append(sqlattr(ob, 'username'))
 data.sort()
 return data

 def getUsers(self):
 """Return a list of user objects or [] if no users exist"""
 data=[]
 try:items=self.sqlListQuery()
 except: return data
 for ob in items:
 user=User(sqlattr(ob, 'username'),
   sqlattr(ob, 'password'),
   sqlattr(ob, 'roles'),
   sqlattr(ob, 'domains'))
 data.append(user)
 return data

 def getUser(self, name):
 """Return the named user object or None if no such user exists"""
 if name==self._super.getUserName():
 return self._super
 try:ob=self.sqlUserQuery(username=name)
 except: return None
 if not ob:
  

Re: [Zope] How to require an @ symbol in email form field??

2000-07-22 Thread ed colmar


Couldn't you do something similar to Squishdot's "validArticle" dtml
method?  In addition to verification that the fields are filled in, you
could pass the email variable off to a python regular expression that
checks for [EMAIL PROTECTED] syntax.

-ed-


At 07:21 PM 7/21/00 -0400, you wrote:
On Tue, 18 Jul 2000, Duncan Booth wrote:
 Use javascript to check that all required fields are present before 
 the form is actually submitted. Here is some of the code I use:

Note, however, that using Javascript to do the checking client side
is only useful as a user convenience.  


___
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] Catalog contains items, but no results

2000-07-21 Thread ed colmar

Hmmm,  more catalog strangeness..

I've finally gotten my product to add objects to a catalog correctly (with
the correct URL) Whee!   

On my 2.2 development machine all appears fine, but on the 2.1.6 production
server all searches come back with no results.  When I look in "cataloged
objects" in the management interface, there are many objects with correct
URLs...???

Obviously I could just upgrade the production server, but I'm curious if
there's something inherently wrong with my code.

This is a sample of a call that I make to the Catalog.

base_url=self.site_url()
self.Catalog.catalog_object(ob,base_url+'/Promoters/'+id)

Thanks for any ideas.

-e-


___
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] more catalog issues

2000-07-21 Thread ed colmar

Strange...

Now my 2.2 catalog is giving me the problems were supposed to be bugs in
zope (catalog) 2.1.5 and lower...  Inconsistancy, and missing indexes...???

When I update the catalog it corrects itself.  h

Any clues as to why my objects get cataloged incorrectly to start with?

Is there a better syntax to use than 'catalog_object()'?

Thanks for any pointers!

-e-


___
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] looping through objectValues, how to get methods?

2000-07-19 Thread ed colmar

I have a method that looks through "objectValues".  Using "hasattr" and
"getattr" I can see the variables contained in the object.  

How do I get the values generated from an object's method in a similar
fashion?  

For example:

def dj_experince_statistics(self):
"""  

"""
rlist = self.People.objectValues('SRPersonPost')
newbcount=0
for i in rlist:
if hasattr(i, 'validated'):  #get validated variable
if hasattr(i, 'djname'): #get djname variable
if hasattr(i, 'mixing_for()'):  #try to get
mixing_for() method
days_mixing=getattr(i,'mixing_for()')
if days_mixing  730.0:
newbcount=newbcount+1 
return newbcount


BTW this does not work.

Thanks for any suggestions!

-ed-


___
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] strange catalog problem

2000-07-08 Thread ed colmar

Here's a weird one.

I'm testing out my products catalog functionality, and I'm seeing strange
results.

I add an object "A" with an indexed variable called 'styles' that contains
the values: ['Ambient', 'Breakbeat', 'Downtempo']

I add a second object "B" with the varaibles:  ('Ambient', 'Breakbeat',
'Downtempo', 'Hardcore', 'Hip-Hop', 'House', 'Jungle', 'Techno', 'Trance')


When I search for these varables, the results get somewhat mixed up.  3
incorrect searches out of 8.

search for:   results:
Ambient B*
Breakbeat   AB
Downtempo   AB
HardcoreA*
Hip-Hop *
House   B
Jungle  B
Techno  B
Trance  B


All these variables are inputted through a select box, so the spelling/case
should be identical.  There's some kind of a pattern here though, I don't
quite see it.


this is the call that I'm using to index the object:
self.Catalog.catalog_object(ob,'Promoters/'+id)


Anyone have any idea what might be causing this?


___
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] ZCatalog in python (getting closer)

2000-06-14 Thread ed colmar

I am getting closer to having a working catalog.  Thanks everyone, all your
hints have been really helpful.

The catalog is automatically created when I add a new instance of my class
to a folder

My sub-classes now inherit: (CatalogAware, Persistent, Implicit, SimpleItem)

It was the SimpleItem combined with the code used (in squishdot) to add an
item that was preventing the catalog from finding it.  When I changed it to:

ob=PromoterPost(id,title)
ob.id = id
ob.title = title

self._setObject(id,ob)

It can now be found by the catalog when I manually update it in the
management screen.  It also now exists in the zope management screens,
which is forcing me into better object management. =P

Still, the catalog does not automatically update when a new object is added.

can someone explain where the index_object() call should be?  In my case it
should be in the PromoterPost.__init__ method correct?  It does not belong
in my base class' call that creates the object right?

Thanks again!

-ed-  


___
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] ZCatalog in python

2000-06-10 Thread ed colmar

I'm in a similar situation with Aaron, except my product is mostly python.
 I emulated the cataloging in the PortalCatalog method, but left out the
permission check.  When my product is added to a folder, the catalog gets
created, and has the indexes I set up.  I can create a zsearchinterface,
and search/find the instance of my product, but none of the data that
exists below that.

Do my sub-objects need to inherit from any zope classes in order to get
indexed?  I know the Zclasses do this automatically, what's the majick
trick for this in python?

I have tried, catalogAwareness, index_object at item creation, and
reindex_object at item edit.  none of these seem to do it, I imagine
because the catalog wants them to be a certain type, and they're not.  

Any ideas?


___
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] still trying to get Catalog to work in my python product

2000-05-23 Thread ed colmar

Thanks to everone who has given me suggestions on this.  I really do
appreciate it.

After looking over the PTK snapshot, I've tried to duplicate the catlog
that is implemented there.  I could not find any search utilities built in,
so I'm assuming this is still done by adding the ZsearchInterface from the
management screen.  Is this right, or is there some built-in PTK searching
tool?

So now I have a "myproductcatalog" class which inherits ZCatalog.  All it
does is set up the Indexes, and columns

In my base class, I initialize the catalog using (PTK code):

# Install MyCatalog
id = 'SiteIndex'
catalog = MyCatalog(id, '')
self._setObject(id, catalog)
catalog = self.SiteIndex
catalog.initialize()



My sub-classes are all catalog aware, with reindex-object in all of the
editing areas.  

I don't see my catalog when I go to add a Zsearch interface.  Am I
supposed to?  What else do I need to do to make this work?

-ed-


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