Re: [Zope-dev] Log name variable and log procedure ( connection client )

2004-07-12 Thread Dieter Maurer
listador listas wrote at 2004-7-12 12:36 +0200:
>This morning, I need to know which is the source IP
>where the client is connected from.

"REQUEST['REMOTE_ADDR']".

Note, however, that it is not too difficult to forge it.

Moreover, when you put another web server in front of Zope (recommended),
then "REMOTE_ADDR" may contain the IP address of this proxy.
Apache provides a way ("proxy_via") to make the correct address
available (up to forging).

>I was found across the code but I cannot find
>anything, can anybody tell me where is the procedure
>(file) that calls the log procedure with the IPś
>client ?

What?
I do not understand this part of your question...

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


Re: [Zope-dev] StringIO and Zope

2004-07-12 Thread Tim Peters
[Oskar Wilhelmsen]
> I can't print tracebacks. I'm unfortunatly on a windows system, an whats
> happen is tha Python jus quits, with no fault description.
> 
> A type(data)  gives me DbiRaw, which is the type of data in the DB

OK, can you break the line into two lines, as suggested before?  Since
you're getting no traceback info of any kind, it's impossible from
what you've said so far to guess whether the problem is in StringIO or
in DbiRaw's __str__ implementation.  And since nobody else has said
"ya, I see that too!", you're the only one who *can* supply additional
info .
___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] StringIO and Zope

2004-07-12 Thread Tor Oskar Wilhelmsen
Hi
I can't print tracebacks. I'm unfortunatly on a windows system, an whats
happen is tha Python jus quits, with no fault description.

A type(data)  gives me DbiRaw, which is the type of data in the DB

-TOW
- Original Message - 
From: "Tim Peters" <[EMAIL PROTECTED]>
To: "Tor Oskar Wilhelmsen" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, July 12, 2004 7:41 PM
Subject: Re: [Zope-dev] StringIO and Zope


> [Oskar Wilhelmsen]
> > I have a problem with python 2.3.3 and Zope 2.7.0. When I Execute the
code
> > below, Python just get som unhandled exceptions, and crash?
>
> What are (exactly) the "unhandled exceptions"?  Can you paste in
tracebacks?
>
> > from cStringIO import StringIO
> > #pic[3] is a blob in a database
> > data = pic[3]
> >
> > fil = StringIO(str(data)) #this line makes Zope and Python crash
>
> Since you later said it didn't matter whether you used StringIO or
> cStringIO, it would be helpful to beak that into two lines:
>
> temp = str(data)
> fil = StringIO(temp)
>
> Might also help to print type(data).  Since str() and StringIO() are
> so heavily used, it's unlikely the problem is in either of them.  Most
> likely is a problem in type(data)'s __str__ or __repr__
> implementations.
>


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


ZODB sticky conflicts (was: Re: [Zope-dev] Re: "hasattr" geddon)

2004-07-12 Thread Dieter Maurer
Tim Peters wrote at 2004-7-10 17:55 -0400:
> ...
>Which is why the current ZODB releases intend to prevent committing a
>transaction if a conflict error occurred during the transaction.  It
>shouldn't matter to this ZODB machinery if the application suppressed
>the original conflict error(s), ZODB remembers that it raised
>ReadConflictError regardless (via the Connection._conflicts
>set-implemented-as-a-dict).
>
>Hmm.  The lack of design documentation is frustrating.  Staring at the
>code, it could be that  ZODB only prevents a transaction commit if the
>transaction tries to *commit* at least one object that suffered a
>conflict error,  I don't know ... if you have a specific case in mind,
>please open a Collector report about it.

This is indeed the case:

  The code you mentioned prevents the modification (i.e. "commit")
  of an object that caused a "ReadConflictError" when it
  has been accessed -- whether or not the exception has been
  caught or not.

Shane seems to want a stricter behaviour: something like:

  def commit(...):
  ...
  if self._conflicts:
  raise SpecialConflictError(...)

   i.e. prevent the commit, when the transaction saw any
   conflict whether or not it tries to modify such an object.

However, I think his wish is not necessary.

  Even when a "ReadConflictError" was swallowed, the object has not
  been read and its state is still undefined.
  Whenever the application tries to read an attribute,
  the object is refetched and the "ReadConflict" reissued.
  When the conflict successfully trickles down to the
  "commit", then in fact, the transaction was independent
  from the state of the respective object...

  The only thing, the application can do is do write
  the object. However, "writing" implies fetching the
  object -- with the consequence of another "ReadConflict"
  (if I am right, then the code in "commit" is redundant,
  as the application is unable to write an object that
  could not be fetched due to a "ReadConflict").

The problem that remains:

  The application swallowed an exception and, as a consequence,
  did not recognize that it was unable to *write* an object.
  It performs its other writes and commits. In this
  case, the originally written object remains unchanged
  and inconsistent with respect to other objects.

  Shanes wish would recognize this situation.

Obviously, I have to retract my previous thought :-)

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


Re: [Zope-dev] Re: "hasattr" geddon

2004-07-12 Thread Dieter Maurer
Shane Hathaway wrote at 2004-7-10 02:41 -0600:
> ...
>Hmm.  I just heard about this "hasattr geddon".  hasattr is *good*.  Why are 
>we fixing hasattr and bare excepts when the real problem is ZODB?

That's even better!

However, we may still be interested to get an exception unswallowed
by "hasattr". Usually, there is some sense in not continuing
an expensive computation when we know it will finally fail...

When we fix ZODB, we should note that information about the precise
cause is helpful in fixing the underlaying problem.
Thus, something like the original exception, maybe even with a
traceback representation, should be available.

> ...
>That said, I was surprised to discover that Python 2.3 implements hasattr this 
>way (from bltinmodule.c):

Me, too...

> ...
>I suggest 
>the consistency between getattr and hasattr should be fixed in Python, not 
>Zope.

Tim explained a bit why "hasattr" is like it is...

And when we cannot change it in Python, we may need our own "hasattr"...


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


Re: [Zope-dev] StringIO and Zope

2004-07-12 Thread Tim Peters
[Oskar Wilhelmsen]
> I have a problem with python 2.3.3 and Zope 2.7.0. When I Execute the code
> below, Python just get som unhandled exceptions, and crash?

What are (exactly) the "unhandled exceptions"?  Can you paste in tracebacks?

> from cStringIO import StringIO
> #pic[3] is a blob in a database
> data = pic[3]
> 
> fil = StringIO(str(data)) #this line makes Zope and Python crash

Since you later said it didn't matter whether you used StringIO or
cStringIO, it would be helpful to beak that into two lines:

temp = str(data)
fil = StringIO(temp)

Might also help to print type(data).  Since str() and StringIO() are
so heavily used, it's unlikely the problem is in either of them.  Most
likely is a problem in type(data)'s __str__ or __repr__
implementations.
___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] Re: StringIO and Zope

2004-07-12 Thread Tor Oskar Wilhelmsen
No the problem is exactly the same with StringIO and cStringIO

-Tow
- Original Message - 
From: "Tres Seaver" <[EMAIL PROTECTED]>
Newsgroups: gmane.comp.web.zope.devel
To: "Tor Oskar Wilhelmsen" <[EMAIL PROTECTED]>
Sent: Monday, July 12, 2004 7:01 PM
Subject: Re: StringIO and Zope


> Tor Oskar Wilhelmsen wrote:
> 
> > I have a problem with python 2.3.3 and Zope 2.7.0. When I Execute the
> > code below, Python just get som unhandled exceptions, and crash? Why?
>  > Does anyone know???
> > 
> > from cStringIO import StringIO
> > #pic[3] is a blob in a database
> > data = pic[3]
> > 
> > fil = StringIO(str(data)) #this line makes Zope and Python crash
> 
> Does the problem go away if you change the import to:
> 
>from StringIO import StringIO
> 
>  From the cStringIO library documentation 
> (http://docs.python.org/lib/module-cStringIO.html):
> 
> > Unlike the memory files implemented by the StringIO module, those
>  > provided by this module are not able to accept Unicode strings that
>  > cannot be encoded as plain ASCII strings.
> 
> 
> Tres.
> -- 
> ===
> Tres Seaver[EMAIL PROTECTED]
> Zope Corporation  "Zope Dealers"   http://www.zope.com
> 

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


[Zope-dev] Re: StringIO and Zope

2004-07-12 Thread Tres Seaver
Tor Oskar Wilhelmsen wrote:
I have a problem with python 2.3.3 and Zope 2.7.0. When I Execute the
code below, Python just get som unhandled exceptions, and crash? Why?
> Does anyone know???
from cStringIO import StringIO
#pic[3] is a blob in a database
data = pic[3]

fil = StringIO(str(data)) #this line makes Zope and Python crash
Does the problem go away if you change the import to:
  from StringIO import StringIO
From the cStringIO library documentation 
(http://docs.python.org/lib/module-cStringIO.html):

Unlike the memory files implemented by the StringIO module, those
> provided by this module are not able to accept Unicode strings that
> cannot be encoded as plain ASCII strings.
Tres.
--
===
Tres Seaver[EMAIL PROTECTED]
Zope Corporation  "Zope Dealers"   http://www.zope.com
___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] StringIO and Zope

2004-07-12 Thread Tor Oskar Wilhelmsen



Hi
 
I have a problem with python 2.3.3 and Zope 2.7.0. 
When I Execute the code below, Python just get som unhandled exceptions, and 
crash? Why? Does anyone know???
 
 
from cStringIO import StringIO
#pic[3] is a blob in a database
data = 
"">fil 
= StringIO(str(data)) #this line makes Zope and Python crash
 
 
-Tor Oskar Wilhelmsen
___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] 2.7 series dropped PASV_FTP_PORTRANGE

2004-07-12 Thread Brad Clements
In the 2.6 series I submitted a patch to support specifying the range of tcp ports to 
use on 
the server for pasv ftp transfers.

I still need this functionality, but I see that the "environment variable hack" isn't 
in 
medusa/ftp_server.py

I thought perhaps something in zope.conf would specify this, but it seems not to be 
there.

In fact, I see no clean way to pass port range information from ZServer.FTPServer to 
medusa.ftp_server  (hence why we used an environment variable hack in the past)

For my use case, the pasv port range is always "near" the range used by the listening 
ftp 
daemon anyway, so a simple solution for me is to look at the control connection port 
and just 
find an open port that is "nearby".

However the better solution, I suppose, is to allow the port range to be specified in 
zope.conf.

But what's the best way (architecturally) to cleanly get this information into 
medusa's 
ftp_server.py module?




-- 
Brad Clements,[EMAIL PROTECTED]   (315)268-1000
http://www.murkworks.com  (315)268-9812 Fax
http://www.wecanstopspam.org/   AOL-IM: BKClements

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


[Zope-dev] Log name variable and log procedure ( connection client )

2004-07-12 Thread listador listas
This morning, I need to know which is the source IP
where the client is connected from.
I was found across the code but I cannot find
anything, can anybody tell me where is the procedure
(file) that calls the log procedure with the IPś
client ?

Thanks





__
Yahoo! lanza su nueva tecnología de búsquedas
¿te atreves a comparar?
http://busquedas.yahoo.es
___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )