[Zope-dev] Problems with Zope 2.8 on FreeBSD (was Re: Problems with PageTemplates on Zope 2.8)

2005-06-30 Thread Morten W. Petersen
 I have an application called the Issue Dealer which I'm porting to Zope
 2.8.  However, whenever I try to access a PageTemplate which makes use
 of a page template macro it just hangs and consumes all available CPU.

 Any ideas what could be wrong here, or how I could debug it?
 
 Does the server or the client hang?

It's the client that's hanging.  The first time I tested it, it was as a
simple Zope instance.  http://instance/manage worked fine, but accessing
an Issue Dealer instance (http://instance/stuff) didn't work.

Now when I try setting up a ZEO server/client version 2.8 with python
2.3.5 on FreeBSD 5.4, the server hangs even when I try to access
http://instance/manage.  http://instance/manage_copyright works fine
however.

-Morten
begin:vcard
fn:Morten Petersen
n:Petersen;Morten
org:Nidelven IT
adr:;;Postboks 923;Trondheim;;7409;Norway
email;internet:[EMAIL PROTECTED]
title:Project Manager
tel;work:+47 45 44 00 69
tel;cell:+47 45 44 00 69
x-mozilla-html:FALSE
url:http://www.nidelven-it.no
version:2.1
end:vcard

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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: Windows Builds

2005-06-30 Thread Tim Peters
[Tim Peters]
 Anyone else run on Windows routinely who's eager for glory?  As
 Christian learned the hard way, it doesn't really work if running on
 Windows is an occasional afterthought in your daily life.
 
[Andy McKay]
 Mark Hammond and I will take a look at this and see if we can help.

Cool!  Last I saw, Andreas was planning to release Zope 2.7.7b1 this
Sunday (3 July), if you want some practice wink.

I'm pretty sure Mark already understands the Zope Windows-installer
build process about as well as anyone.  If not, I'm happy to help. 
For someone who runs on Windows routinely, the machinery usually works
smoothly.  It can be a bear when it doesn't.

One predictable problem is that Zope's setup.py gets out of date over
time, because people run Zope tests from CVS or SVN checkouts in
place, and the repackaging done by setup.py for an installation never
gets tested that way.  It's broken then for all platforms, but
typically whoever builds the WIndows installer is the first to
_notice_ it.  For a micro release (like 2.7.6 - 2.7.7) a problem
there is unlikely.
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] Extending Zope's ZConfig Schema in a Product?

2005-06-30 Thread Sidnei da Silva
Hello,

I've been hitting my head against the wall for a few hours already, so
I thought it would be a good time to ask before the house falls apart
*wink*.

I'm looking back and forth between the Zope and ZConfig sources and
documentation to see if I can figure out how to have a Product (or a
python package) to extend Zope's ZConfig schema
(a.k.a. Zope/Startup/zopeschema.xml) without having to reach into the
guts of ZConfig.

It looks like the right way to do this would be to extend Zope's
schema and then specify a different 'schemafile' to ZopeOptions, but
that's not currently possible as Zope doesn't support the '-S
schemafile' switch that ZDCtlOptions does.

If what I'm looking for seems just stupid please tell me *wink*.

All I want to do is to add a simple config 'key' to zope.conf without
having to patch the Zope source.

Having no other choices, I would go with having my own schema and
configfile, but that would be sub-optimal.

Thank you for any help,

-- 
Sidnei da Silva
Enfold Systems, LLC.
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] Extending Zope's ZConfig Schema in a Product?

2005-06-30 Thread Andrew Langmead

I'm looking back and forth between the Zope and ZConfig sources and
documentation to see if I can figure out how to have a Product (or a
python package) to extend Zope's ZConfig schema
(a.k.a. Zope/Startup/zopeschema.xml) without having to reach into the
guts of ZConfig.




The config file syntax has a %import directive that allows you to  
add another package to handle certain config directive.
That package than can contain a an XML file that describes your new  
configuration directives and the code to handle them.


I  posted a small sample a few months ago here:
http://mail.zope.org/pipermail/zope-dev/2005-January/024244.html
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] Extending Zope's ZConfig Schema in a Product?

2005-06-30 Thread Sidnei da Silva
On Thu, Jun 30, 2005 at 10:21:40PM -0400, Andrew Langmead wrote:
| The config file syntax has a %import directive that allows you to  
| add another package to handle certain config directive.
| That package than can contain a an XML file that describes your new  
| configuration directives and the code to handle them.

Gosh, that looks too nice to be true. I will try that out tomorrow and
write out a how-to on zope.org if it works out.

-- 
Sidnei da Silva
Enfold Systems, LLC.
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] Extending Zope's ZConfig Schema in a Product?

2005-06-30 Thread Fred Drake
On 6/30/05, Sidnei da Silva [EMAIL PROTECTED] wrote:
 Gosh, that looks too nice to be true. I will try that out tomorrow and
 write out a how-to on zope.org if it works out.

It is too good to be true; sorry.

Well, it is true, but it's not what you're looking for.  You can't use
it to extend the schema for Zope.  You can use it to add new concrete
implementations for things that are allowed; the original use-case was
to allow things like new kinds of storage for the database.

I've spent a little time thinking about this issue, and have come up
with at least one way to deal with it (and %import would be used, in
part), but I've never been completely happy with the approaches.

Since using an additional configuration file is possible (and quite
easy in Zope 2, since the location of the instance is so easy to
discern, I'm not convinced it's actually important to support
embedding the configuration for 3rd-party components into zope.conf. 
If you want something you can use now, using a product-specific
configuration file, with an appropriate schema, will do quite well. 
It also doesn't require hacking (or monkey-patching) Zope or ZConfig,
so it would be easy to deploy in a variety of situations.


  -Fred

-- 
Fred L. Drake, Jr.fdrake at gmail.com
Zope Corporation
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] how to get info about an object (dir/type)

2005-06-30 Thread gabor

hi,

while working with zope, i many times have the following problem:

i find a method that i can use, and the documentation (for example) says:
returns the current user.

ok, but what kind of object is it?
what methods does it have?

usually i would simply call dir() or type() on the result object,
but those are forbidden in zope.

how do you usually solve this?

gabor
___
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] how to get info about an object (dir/type)

2005-06-30 Thread gabor

Andreas Jung wrote:



--On 30. Juni 2005 13:48:19 +0200 gabor [EMAIL PROTECTED] wrote:


hi,

while working with zope, i many times have the following problem:

i find a method that i can use, and the documentation (for example) says:
returns the current user.

ok, but what kind of object is it?
what methods does it have?



lib/python/AccessControl/User.py is your friend.



thanks for your help,

but .. it is not about this specific issue (about the current user)..

generally.. if i have a reference to an object.
how do i find out what his methods are?

gabor
___
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] how to get info about an object (dir/type)

2005-06-30 Thread Jonathan


- Original Message - 
From: gabor [EMAIL PROTECTED]

To: zope@zope.org
Sent: Thursday, June 30, 2005 7:48 AM
Subject: [Zope] how to get info about an object (dir/type)


while working with zope, i many times have the following problem:

i find a method that i can use, and the documentation (for example) says:
returns the current user.

ok, but what kind of object is it?
what methods does it have?

usually i would simply call dir() or type() on the result object,
but those are forbidden in zope.


You can create a small utility external method to call dir() and type() 
(very useful!)



Jonathan 



___
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] how to get info about an object (dir/type)

2005-06-30 Thread Andreas Jung



--On 30. Juni 2005 14:04:14 +0200 gabor [EMAIL PROTECTED] wrote:


Andreas Jung wrote:



--On 30. Juni 2005 13:48:19 +0200 gabor [EMAIL PROTECTED] wrote:


hi,

while working with zope, i many times have the following problem:

i find a method that i can use, and the documentation (for example)
says: returns the current user.

ok, but what kind of object is it?
what methods does it have?



lib/python/AccessControl/User.py is your friend.



thanks for your help,

but .. it is not about this specific issue (about the current user)..

generally.. if i have a reference to an object.
how do i find out what his methods are?



By determining its class or meta_type and then by checking the related 
documentation, source code of the class or its base classes? Of course
type() does not work in RestrictedPython. Bascially you should know the 
objects you're dealing with...otherwise this sounds like a problem with 
your application to me :-) Otherwise use type() from within unrestricted 
code.


-aj

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


Re: [Zope] how to get info about an object (dir/type)

2005-06-30 Thread Peter Bengtsson
 
 usually i would simply call dir() or type() on the result object,
 but those are forbidden in zope.
 
 how do you usually solve this?
 
External methods. You might even want to have a general debugging
script lying around that you can use to exploit dir() and type() and
__class__.__name__ from your zope.
Bare in mind that there's a security reason why these aren't available
in zope but if it's only you using the tools, it's safe.

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


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


Re: [Zope] how to get info about an object (dir/type)

2005-06-30 Thread Nikko Wolf

See: http://epydoc.sourceforge.net/  (which I have not yet used).

Andreas Jung wrote:

--On 30. Juni 2005 13:48:19 +0200 gabor [EMAIL PROTECTED] wrote:


generally.. if i have a reference to an object.
how do i find out what his methods are?


By determining its class or meta_type and then by checking the related 
documentation, source code of the class or its base classes? Of course
type() does not work in RestrictedPython. Bascially you should know the 
objects you're dealing with...otherwise this sounds like a problem with 
your application to me :-) Otherwise use type() from within unrestricted 
code.


While this may be the most direct answer, on my system there are ~2200 
Python source files for Zope+Plone.  Most of the objects I've tried to 
inspect through source code have had multiple parent classes, and some 
of the parent classes did, too.


Consequently it can be a long and tedious undertaking to simply find out 
which method or attribute name to use, eg: title, Title, getTitle(), 
get_title(), Title() ... etc.


Peter Bengtsson wrote:

usually i would simply call dir() or type() on the result object,
but those are forbidden in zope.

how do you usually solve this?



External methods. You might even want to have a general debugging
script lying around that you can use to exploit dir() and type() and
__class__.__name__ from your zope.
Bare in mind that there's a security reason why these aren't available
in zope but if it's only you using the tools, it's safe.


Peter (or anyone else) -- do you have an Extension that you'd be willing 
to share?   Or is there one already on Zope.org that I missed?


Nikko
___
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] how to get info about an object (dir/type)

2005-06-30 Thread Andy McKay

gabor wrote:

 hi,

 while working with zope, i many times have the following problem:

 i find a method that i can use, and the documentation (for example) says:
 returns the current user.

 ok, but what kind of object is it?
 what methods does it have?

 usually i would simply call dir() or type() on the result object,
 but those are forbidden in zope.

Use of the debug prompt is your friend. On Linux you can do zopectl 
debug, get the object and then dir(), type() it all you want.


We recently released PloneShell which is not actually Plone specific, 
but might be of help:


http://www.enfoldsystems.com/Products/Open/PloneShell

All you need is wxPython and you are up and running ;)
--
  Andy McKay
  Enfold Systems, LLC
  http://www.enfoldsystems.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

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


[Zope] fcForum

2005-06-30 Thread hpinson
Does anyone know the status of the fcForum product?  Is it still in 
production?  Posts on the http://fcforum.techfuel.net website seem to 
have gone unanswered for several months now.

Harlow Pinson
Indepth Learning
Email: [EMAIL PROTECTED] 
Web: http://www.indepthl.com
Voice: 505-994-2135
FAX: 208-475-7678

___
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] strcoll_nocase gone after moving site?

2005-06-30 Thread Daniel Dekany
I have to move a Plone site to another server (from some FreeBSD to a
new Trustix), while also switching from Zope 2.7.x5 to 2.7.6, and from
Python 2.3.x5 to Python 2.3.5. I have built everything from source,
copied 1:1 the Products and Extension directory into a fresh new zope
instance, also imported the exported Plone site into it. Was this
procedure incorrect? Because till now the result is a disaster; things
that worked till now suddenly don't work anymore.

Anyway, this is what currently seems to win over me:

DocumentTemplate\sequence\SortEx.py line 172:

elif f_name in (locale_nocase, strcoll_nocase):
func = strcoll_nocase


And here global name 'strcoll_nocase' is not defined. I figured this
is because in the same file earlier, line 136:

import sys
if sys.modules.has_key(locale): # only if locale is already imported
from locale import strcoll

def strcoll_nocase(str1, str2):
return strcoll(str1.lower(), str2.lower())

and there the condition of the if is false. If I add

  import locale

before that if, then the error disappears.

Any idea what's going on? Why is the locale module be expected to be
already imported, and why is it not imported when it was on the other
server?

-- 
Best regards,
 Daniel Dekany

___
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] Import problem

2005-06-30 Thread George Tesseris




When I try to import a specific .zexp the following error is raised:

Error Type: AttributeError
Error Value:
('__new__', function __newobj__ at 0x00B8B0F0, (extension
class Shared.DC.ZRDB.DA.SQL at 01AE2728,))

Help please... It's crucial...

George



___
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] Checking for an Integer Argument

2005-06-30 Thread Asad Habib
Is there any way to check if an argument is an integer in Python?
Offcourse, there is the int function but it chokes when passed an argument
that is not a string and then the user is inconvenienced (it throws a
ValueError to be specific). I guess I could check each digit of the
integer to determine if its ASCII value falls within the appropriate range
and if each digit passed this test, then the entire number would be an
integer. Does anyone know of a simpler way that involves use of a
predefined Python function? Likewise, does anyone know if a similar
function exists to detect floating point numbers? Any help would be
appreciated. Thanks.

- Asad
___
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] Checking for an Integer Argument

2005-06-30 Thread Dennis Allison

in Zope Python Scriptssametype( x, 1 )



On Thu, 30 Jun 2005, Asad Habib wrote:

 Is there any way to check if an argument is an integer in Python?
 Offcourse, there is the int function but it chokes when passed an argument
 that is not a string and then the user is inconvenienced (it throws a
 ValueError to be specific). I guess I could check each digit of the
 integer to determine if its ASCII value falls within the appropriate range
 and if each digit passed this test, then the entire number would be an
 integer. Does anyone know of a simpler way that involves use of a
 predefined Python function? Likewise, does anyone know if a similar
 function exists to detect floating point numbers? Any help would be
 appreciated. Thanks.
 
 - Asad
 ___
 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 )
 

-- 
Dennis Allison * Computer Systems Laboratory * Gates 227
   * Stanford University *  Stanford CA  94305
   * (650) 723-9213 * (650) 723-0033 fax
   * [EMAIL PROTECTED]
   * [EMAIL PROTECTED]


___
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] how to get info about an object (dir/type)

2005-06-30 Thread Dieter Maurer
gabor wrote at 2005-6-30 13:48 +0200:
while working with zope, i many times have the following problem:

i find a method that i can use, and the documentation (for example) says:
returns the current user.

ok, but what kind of object is it?
what methods does it have?

usually i would simply call dir() or type() on the result object,
but those are forbidden in zope.

DocFinder can help you.

You might need a small script that obtains the object you
are interested in and than calls DocFinder with it.



  http://www.dieter.handshake.de/pyprojects/zope


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


Re: [Zope] how to get info about an object (dir/type)

2005-06-30 Thread Dieter Maurer
Peter Bengtsson wrote at 2005-6-30 13:36 +0100:
 ...
External methods. You might even want to have a general debugging
script lying around that you can use to exploit dir() and type() and
__class__.__name__ from your zope.
Bare in mind that there's a security reason why these aren't available
in zope but if it's only you using the tools, it's safe.

You can also use your favorite tools in an interactive
Python interpreter session.

Under *nix, it looks like:

  bin/zopectl debug
  obj = app.unrestrictedTraverse(path_to_some_interesting_object)
  dir(obj); type(obj)
  u = obj.getUser(...)
  dir(u)
  ...

You must either use ZEO or shut down you Zope while you access it
like shown above...

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


[Zope] Starting a search from the correct folder

2005-06-30 Thread John Poltorak


I have some code which here:-

divtal:loop tal:repeat=item python: request.PARENTS[-2::-1]gt;
  a href=ABSOLUTE_URL
 tal:attributes=href item/absolute_url
 tal:content=item/title_or_idPARENT TITLE OR
ID/a /tal:loop/div

ul tal:condition=python: context.objectValues(['Folder'])
  li tal:repeat=item python: context.objectValues(['Folder'])
a href=ABSOLUTE_URL
   tal:attributes=href item/absolute_url
   tal:content=item/title_or_idSUB-OBJECT TITLE OR ID/a/li
/ul


which automatically generates links to a number of folders which is 
exactly what I want. Understanding that Zope could do something like this 
has taken me quite a bit of time, although I still don't understand how 
this code works. What it actualy does is list the folders in the current 
folder and then allows me to select one which generates a subsequent list.
What I'd like to do is skip the first list. If I want to generate a list 
of folders in say the 'groups' folder, how would I change the code above?


-- 
John


___
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] Checking for an Integer Argument

2005-06-30 Thread Paul Winkler
On Thu, Jun 30, 2005 at 05:04:31PM -0400, Asad Habib wrote:
 Is there any way to check if an argument is an integer in Python?
 Offcourse, there is the int function but it chokes when passed an argument
 that is not a string and then the user is inconvenienced (it throws a
 ValueError to be specific). 

Well, to be precise, int() accepts strings as long as they can sensibly be
converted to integers, but it also accepts integers and floats.
For floats, it truncates them.  For other strings, it raises
a ValueError. For everything else, it raises a TypeError.

 I guess I could check each digit of the
 integer to determine if its ASCII value falls within the appropriate range
 and if each digit passed this test, then the entire number would be an
 integer.  Does anyone know of a simpler way that involves use of a
 predefined Python function? Likewise, does anyone know if a similar
 function exists to detect floating point numbers? Any help would be
 appreciated. Thanks.

It sounds to me like you don't want to know if an argument is an integer,
but rather if an argument is a string that looks like an integer.
I interpret this as: Can this object be converted to an integer
without problems and without losing information?

Something like this might do, depending on how you want it
to handle floats such as 1.0:

 def looks_like_int(n):
... try:
... int(str(a))
... return True
... except (TypeError, ValueError):
... return False
... 
 looks_like_int(1)
True
 looks_like_int(1)
True
 looks_like_int(1.0)
False
 looks_like_int(1.0)
False
 looks_like_int(1.3)
False
 looks_like_int(1.3)
False
 looks_like_int(None)
False
 looks_like_int(abc)
False

-- 

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


Re: [Zope] Starting a search from the correct folder

2005-06-30 Thread Andreas Jung



--On 30. Juni 2005 22:27:37 +0100 John Poltorak [EMAIL PROTECTED] wrote:




I have some code which here:-

divtal:loop tal:repeat=item python: request.PARENTS[-2::-1]gt;
  a href=ABSOLUTE_URL
 tal:attributes=href item/absolute_url
 tal:content=item/title_or_idPARENT TITLE OR
ID/a /tal:loop/div

ul tal:condition=python: context.objectValues(['Folder'])
  li tal:repeat=item python: context.objectValues(['Folder'])
a href=ABSOLUTE_URL
   tal:attributes=href item/absolute_url
   tal:content=item/title_or_idSUB-OBJECT TITLE OR ID/a/li
/ul


which automatically generates links to a number of folders which is
exactly what I want. Understanding that Zope could do something like this
has taken me quite a bit of time, although I still don't understand how
this code works. What it actualy does is list the folders in the current
folder and then allows me to select one which generates a subsequent list.
What I'd like to do is skip the first list. If I want to generate a list
of folders in say the 'groups' folder, how would I change the code above?



What is your real problem? I've read the posting three time and I not still 
not getting to the point what you mean.


-aj


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