[Zope-dev] Re: KeyError in ZRDB.DA cache handling

2008-01-15 Thread J Cameron Cooper

Chris Withers wrote:

Hi there,

J Cameron Cooper wrote:

but we have that fix in our Zope 2.9.8:
  http://osdir.com/ml/web.zope.all-cvs/2006-11/msg00150.html


Are you absolutely sure you're using a version of Zope with my patches 
included?


Yes; I've checked both version (this went in for 2.9.6) and for that 
specific code. You can even see some of it in the excerpt in the 
original message, which I pasted straight from our production Zope.


I had hoped it was simply missing the fix, too, but no dice. Now, I 
can't guarantee that the fix in question has remained working since it 
was checked in, but the release code looks much like the the patch.


Perhaps it is another high-load leak? I don't think it can be multiple 
threads doing cleanup at the same time, unless maybe there's a 
transaction commit in there somewhere I don't know about.


I'm afraid it's long enough ago that this code was touched that I can't 
really comment on this bit :-S


Or maybe I'm running into the problem described in the big comment at 
the end?::


Don't think so, this describes a leak, not a cause of exceptions...

Would it be unsafe to toss a try/except around the del cache[q] bit on 
the theory that it's already deleted, so, hey, why fail? It'd be 
really nice to keep this off of users, even with it if does cause a 
bit of a leak.


Not sure about the try/except, would be better to nail why the key isn't 
there...


I agree, of course, but these do end up being user visible, and a 
workaround, as long as it's not going to cause worse things, would be nice.


Something like the original workaround in the bug might be in order for 
me (rather than a try/except) until the real fix is found.


http://launchpadlibrarian.net/9460742/Zope-2.8.6-cached-result.patch

I don't imagine it can cause more than cache bloat, and we restart 
enough that that shouldn't kill us.


Best bet is to start trying to reproduce this in a unit test, 
which can be pretty hard :-S


Yes, indeed. I did notice that the test you mention in:

https://bugs.launchpad.net/zope2/+bug/143805

doesn't seem to exist, at least in my version.

I'll probably be setting up some logging to try and characterize this 
further,


Any results from this?


I haven't yet inserted anything in production (I get funny looks at the 
suggestion) but we'll be trying to cause it in a development system soon.


   --jcc

--
Connexions
http://cnx.org

Building Websites with Plone
http://plonebook.packtpub.com

___
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] KeyError in ZRDB.DA cache handling

2008-01-04 Thread J Cameron Cooper
On our fairly busy site (http://cnx.org) we're seeing in the logs some 
instances of an error in Shared.DC.ZRDB.DA::


 ...
  Module None, line 97, in search_form_handler
- FSPythonScript at /plone/search_form_handler used for 
/plone/content

- Line 97
   Module Products.RhaptosRepository.Repository, line 537, in 
searchRepository

   Module Products.RhaptosRepository.VersionFolder, line 456, in search
   Module Products.RhaptosModuleStorage.ZSQLFile, line 44, in __call__
   Module Shared.DC.ZRDB.DA, line 492, in __call__
- ExtZSQLMethod at /plone/portal_moduledb/20071212233625.240206723892
   Module Shared.DC.ZRDB.DA, line 393, in _cached_result
 KeyError: (\nSELECT p.*\nFROM persons p\nwhere\n p.firstname ~* 
req('href='::text)\n or\n p.surname ~* req('href='::text)\n or\n 
p.fullname ~* req('href='::text)\n or \n p.personid ~* 
('^'||req('href='::text)||'$')\n or\n p.email ~* 
(req('href='::text)||'.*@')\n\n, 0, 'devrep')


This is trying to remove a key from the ZSQL cache to shrink it down to 
size, but doesn't find the key. From Shared.DC.ZRDB.DA._cached_result:


# if the cache is too big, we purge entries from it
if len(cache) = max_cache:
keys=tcache.keys()
# We also hoover out any stale entries, as we're
# already doing cache minimisation.
# 'keys' is ordered, so we purge the oldest results
# until the cache is small enough and there are no
# stale entries in it
while keys and (len(keys) = max_cache or keys[0]  t):
key=keys[0]
q=tcache[key]
del tcache[key]
del cache[q]   # = line 393, with the error
del keys[0]

It looks a lot like:
  https://bugs.launchpad.net/zope2/+bug/143805
but we have that fix in our Zope 2.9.8:
  http://osdir.com/ml/web.zope.all-cvs/2006-11/msg00150.html

Perhaps it is another high-load leak? I don't think it can be multiple 
threads doing cleanup at the same time, unless maybe there's a 
transaction commit in there somewhere I don't know about.


Or maybe I'm running into the problem described in the big comment at 
the end?::


   # When a ZSQL method is handled by one ZPublisher thread twice in
   # less time than it takes for time.time() to return a different
   # value, the SQL generated is different, then this code will leak
   # an entry in 'cache' for each time the ZSQL method generates
   # different SQL until time.time() returns a different value.
   #
   # On Linux, you would need an extremely fast machine under extremely
   # high load, making this extremely unlikely. On Windows, this is a
   # little more likely, but still unlikely to be a problem.
   #
   # If it does become a problem, the values of the tcache mapping
   # need to be turned into sets of cache keys rather than a single
   # cache key.


Would it be unsafe to toss a try/except around the del cache[q] bit on 
the theory that it's already deleted, so, hey, why fail? It'd be really 
nice to keep this off of users, even with it if does cause a bit of a leak.


I'll probably be setting up some logging to try and characterize this 
further, but anybody have any clues?


   --jcc

--
Connexions
http://cnx.org

Building Websites with Plone
http://plonebook.packtpub.com

___
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] Re: Help with DateTime.earliestTime()

2007-08-27 Thread J Cameron Cooper

Maurits van Rees wrote:

Eric, on 2007-08-26:
To work around this, I've modified the addition so that instead of adding 1 
day, it adds 1.5 days.  This extra half a day is removed by the 
theDateTime.earliestTime() call but is enough to overcome the DST addition 
problem. Ugly hack.


I had the same problem once in the eXtremeManagement Plone product.
For a monthly overview I needed to do something for every day of the
month.  I worked around it with the code below.

day = 1
date = DateTime(2007, 10, 1) # 1 October 2007
while True:
# skipped some lines irrelevant to the DateTime problem
day += 1
try:
date = DateTime(self.year, self.month, day)
except:
break

Hm, that should probably be except DateTime.DateTime.DateError but
there is not really anything else that can go wrong here.


A ConflictError can go wrong here, which is an additional and important 
reason not to have a bare except. There are good reasons without that, 
as well.


--jcc


--
Connexions
http://cnx.org

Building Websites with Plone
http://plonebook.packtpub.com

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

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


[Zope] Re: AttributeError: _get_filename

2007-08-09 Thread J Cameron Cooper

Garito wrote:

Hi!
I try to use Photo Folder 1.3.1 on a Zope 2.9.6 but when I try to upload 
a photo Zope raise's this error:


Traceback (innermost last):
  Module ZPublisher.Publish, line 115, in publish
  Module 
ZPublisher.mapply, line 88, in mapply

  Module ZPublisher.Publish, line 41, in call_object
  Module Products.Photo.Photo, line 754, in manage_addPhoto
  Module OFS.ObjectManager, line 333, in _setObject
  Module 
zope.event, line 23, in notify

  Module zope.app.event.dispatching, line 66, in dispatch
  Module zope.component, line 181, in subscribers
  Module zope.component.site, line 89, in subscribers
  Module zope.interface.adapter
, line 481, in subscribers
  Module zope.app.event.objectevent, line 192, in objectEventNotify
  Module zope.component, line 181, in subscribers
  Module zope.component.site, line 89, in subscribers
  Module zope.interface.adapter
, line 481, in subscribers
  Module OFS.subscribers, line 114, in dispatchObjectMovedEvent
  Module OFS.subscribers, line 137, in callManageAfterAdd
  Module Products.Photo.Photo, line 697, in manage_afterAdd

  Module Products.Photo.Photo, line 375, in imagecomment
AttributeError: _get_filename

Any one could help me, please?


Check your versions against the supported ones, specifically Zope. It 
looks to me like the Photo class stores a PhotoImage in its '_original' 
attributes, and the PhotoImage is supposed to inherit the 
'_get_filename' method from the base Zope Image object.


It may be that this changed between versions, though I don't see it in 
any of my versions of Zope. And I have a lot.


You may have to contact the author/maintainer to see how this is 
supposed to work. Perhaps it is simply a bug.


  --jcc
--
Connexions
http://cnx.org

Building Websites with Plone
http://plonebook.packtpub.com

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

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


[Zope] Re: Declare constructor as public

2007-07-24 Thread J Cameron Cooper

Garito wrote:

Hi Andrew!
In a normal method inside the product's class I use this:
security = ClassSecurityInfo()
security.setPermissionDefault('Freemind', ('Manager', 'Developer'))
security.declareProtected ('Freemind', 'freemind')

But outside the class I have no idea how to create security object

Can I put a code like this outside the class?


No. Permission for a constructor is set when you register it, usually in 
the __init__.py. (context.registerClass)


   --jcc


2007/7/24, Andrew Milton 
[EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]:


+---[ Garito ]--
| Hi all!
|
| How can I declare a product's constructor public?
|
| Thanks!

You have to declare a permission first such as: Add Garito Product
when you
create your product, and register the class.

Then in the ZMI you simply add the roles you want access to that
permission.


--
Connexions
http://cnx.org

Building Websites with Plone
http://plonebook.packtpub.com

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

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


[Zope] Re: Problem w/ ZMySQLDA

2007-07-16 Thread J Cameron Cooper

[EMAIL PROTECTED] wrote:

Forgive my ignorance, but not quite sure how to do that. Nonetheless...
1) There was no problem with any of this on the old server until the 
server crashed.
2) My backups were taken from a time when the old server was was working 
fine.

3) This problem occurs with *all* my shopping carts, not just this one.
Consequently, I have a hard time believing this is a code error. There 
*must* be something more fundamental at play here.


Code and configuration often interact. You may find that one or the 
other was fragile.


   --jcc

I had some problems with the python-eggs, but I don't imagine that's it, 
since the connection works, I can query the database, etc.

TIA,
Tony


-Original Message-
From: Jonathan [EMAIL PROTECTED]
To: zope@zope.org; 
[EMAIL PROTECTED]

Sent: Mon, 16 Jul 2007 9:12 am
Subject: Re: [Zope] Problem w/ ZMySQLDA

- Original Message - From: 
[EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] 
To: zope@zope.org 
mailto:zope@zope.org 
Sent: Monday, July 16, 2007 8:55 AM 
Subject: [Zope] Problem w/ ZMySQLDA 
 
  
  - Original Message -  From: tonylabarbara at aol.com 
  To: zope at zope.org 
  Sent: Saturday, July 14, 2007 5:43 PM 
  Subject: [Zope] Problem w/ ZMySQLDA 
  
  
   Hi; 
   ? I just built out a new server and transfered my databases. I use 
Zope   to 
   server my web sites and ZMySQLDA to interface between the two.  
  Everything 
   seems 
   to be fine. I can see the databases, the tables, the columns in the 
   tables, the 
   permissions are correct, etc. I hook up ZMySQLDA and that seems to be 
   fine. It 
   connects to the database. However, when I go to look at the pages 
from 
   served 
   the database, the browser hangs. Any ideas how to troubleshoot this? 
  
  You should have a MySQL_database_connection object in a folder 
somewhere  (in 
  the ZMI).? The Status for this object should say The database  
connection 
  is open.? There is a Test tab for this object in which you can 
enter  an 
  sql query. If this query works ok, then the next step is to test 
your Z  SQL 
  Method(s). 
  
  Thanks. That clarified a lot. The MySQL query comes back fine. I'm  
troubleshooting a complex shop I had a programmer who worked for me  
build...so it's not my code...and it's complex ;) I went into the  
shopkeeper's side and was able to successfully query the database. I 
was,  for example, able to display the cotton products for editing. 
However,  when I do essentially_the_same_thing TTW with the following 
code snippet,  it hangs! 
  
  tal:block metal:define-macro=content 
  ?? define=dummy python:request.set('category', 5) 
  
  ? tal:block  
metal:use-macro=here/Store/Main_frame_content/macros/content / 
  
  /tal:block 
  
  Furthermore, mytop shows the user is hanging: 
   30 mysqluser?? localhost mrtableclo?? 473? Sleep 
  
  What should I do next to troubleshoot this? 
 
I would test the code outside of tal. Just execute (test) the routine by 
itself to see what it is returning. A couple of things to check: (i) is 
the routine receiving the correct input parameters, (ii) is the routine 
returning what you are expecting. 


--
Connexions
http://cnx.org

Building Websites with Plone
http://plonebook.packtpub.com

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

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


[Zope] Re: 2.6 to 2.10 migration: RuntimeError: maximum recursion depth exceeded

2007-07-12 Thread J Cameron Cooper

Jonas Meurer wrote:

On 12/07/2007 Andreas Jung wrote:

after importing a product from zope 2.6.4 to a 2.10.3 instance, trying
to open the product produces quite a lot of errors in my event.log, and
a traceback in the zope management interface.

Importing as zexp? If yes, this is unsupported.

Yes, I imported the Product as zexp. Why is that unsupported, and how
else may I import it? It doesn't exist in the filesystem hierarchy, as
it's a custom Product which was developed in the ZMI.

.zexp export/import is only supported between identical versions. It's not
a migration tool.


So is there any supported way to migrate a ZClass Product which only
exists in the Zope hierarchy?

I know that ZClasses are depreciated in zope 2.10 anyway, but still the
problem remains for migrations from zope 2.6.4 to 2.9 for example.


If by migration you mean upgrade, then you do it the same as you 
would upgrade any other Zope instance: copy the ZODB to an instance of 
the new software.


   --jcc

--
Connexions
http://cnx.org

Building Websites with Plone
http://plonebook.packtpub.com

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

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


[Zope] Re: catching shorter URLs

2007-07-09 Thread J Cameron Cooper

Aaron Maupin wrote:
I'm trying to make pretty URLs for a game site I'm developing, and due 
to the hosting environment I'm somewhat limited in my Apache URL 
rewrites.  (I've tried the normal mod_proxy / mod_rewrite rules and they 
haven't worked in this environment.)


I'd like the visitors to see

http://games.mydomain.com/game-title

Whereas what's really being accessed is

http://www.mydomain.com/display_game?title=game-title

or any solution that allows me to query a relational database for a game 
title so I don't have to create hundreds of objects in Zope.


The only idea I have now is to use a Virtual Host Monster mapping to 
send visitors using the games.mydomain.com to a folder that contains a 
custom standard_error_message that reads the request object, figures out 
the game title, and queries the database but that's really inelegant.


Is there a way to inspect the request before Zope starts traversing 
objects?


Or any other ideas on how to accomplish what I want?  I'm not new to 
Zope, but I basically use it as a container for Python scripts and 
haven't delved too deeply into it otherwise... so I may be missing 
something obvious.


Why not just make the display_game method get its value from the path? 
That will simplify your task greatly. Here, 'traverse_subpath' is your 
friend.


  --jcc
--
Connexions
http://cnx.org

Building Websites with Plone
http://plonebook.packtpub.com

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

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


[Zope] Re: how to restore a copied instance.

2007-06-26 Thread J Cameron Cooper

Tudor Gabriel wrote:
hi, i needed to reinstall my zope site on another computer so i 
installed (in debian) plone-site using aptitude ... it automatically 
makes a new instance and starts the server.


after that i 
stopped the server ... and copied my site (instance folder) from the other computer over this one. 



when i start /etc/init.d/zope2.9 start ... it doesn't complain , but i 
can't open the site. (same instance names, same port number )


Use 'zopectl fg' to run it in the foreground and see what errors you get.

i tryied another aproach ... copied back the default installed instance 
... and only overwritten the var folder with the data from the original 
site.


this way i hoped that Data.fs which contained all my objects ... will 
automatically become visible.


it doesn't work this way either, it only sees the default objects, i can 
access the site ... but all my objects are not visible.


It's generally much more helpful if you say exactly what is not 
visible -- and where. As is, this is pretty much information-free.


grep shows that the names of the objects  folders are still in Data.fs 
... so they exist ... i think i missed one configuration somewhere ... 
to make the folders added by me visible.


do you know how can i achieve that?


You may be missing a Product. Visit the Zope Control Panel and look for 
a broken box.


Alternately, are there broken object icons in the ZMI for those objects 
which are not visible?


--jcc

--
Connexions
http://cnx.org

Building Websites with Plone
http://plonebook.packtpub.com

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

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


[Zope-PAS] Re: authentication via web services

2007-06-22 Thread J Cameron Cooper

Miles wrote:

Hi,

Has anyone used PAS to authenticate and get properties from a web 
service?  We have a requirement for this in a project, but given the 
current general state of SOAP support in python, I'm not very clear on 
what the best solution might be on this.


If anyone has any experience/advice that they're willing to share, I'd 
be very grateful.


Well, if by web services you mean SOAP, then I don't know. But the 
GMailAuthPlugin (which is really just a demonstrator), the Salesforce 
connector, the OpenID plugin, and the LibertyAuthPlugin could be called 
using web services. Maybe the CAS plugin counts.


If you can communicate with the auth source in Python, it's definite 
fodder for a PAS plugin.


  --jcc
--
Connexions
http://cnx.org

Building Websites with Plone
http://plonebook.packtpub.com

___
Zope-PAS mailing list
Zope-PAS@zope.org
http://mail.zope.org/mailman/listinfo/zope-pas


[Zope] Re: Several questions on Z3 Views backported thru Five

2007-06-22 Thread J Cameron Cooper

Manuel Vázquez Acosta wrote:

Hi all,

I've been asked to deploy a Plone App which must satisfy a load of at least 1200
users over 8 min.

I have tested a fresh Plone 2.5.3 with Zope 2.9.7, plus Squid + CacheFu and
everything went just fine. The laptop didn't even notice such a load.

But, when I installed the Plone App, even much smaller load didn't pass the 
test.


My first guess would be that the cache setup need to be configured to 
work with your application. CacheFu knows about the default setup, but 
not about a custom application. It may therefore not be caching, or be 
caching inappropriately.


I think examining the response headers is the best way to determine this.

   --jcc
--
Connexions
http://cnx.org

Building Websites with Plone
http://plonebook.packtpub.com

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

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


[Zope] Re: 2.9.7 build fails: 'build/lib/linux-i686-2/5/pytz/zoneinfo/Antarctica' does not exist

2007-06-13 Thread J Cameron Cooper

Mikko Ohtamaa wrote:

Hi,

I am trying to build Zope 2.9.7 on Ubuntu Feisty Fawn 7.04. I am
probably enjoying some sort of configuration error. Though I have
installed python-tz package, the installer barks about missing
'Antarctica'. I haven't seen this error with previous Zope builds.

[EMAIL PROTECTED]:~/Zope-2.9.7-final$ make
/usr/bin/python2.4 /home/moo/Zope-2.9.7-final/setup.py \
build
--build-base=/home/moo/Zope-2.9.7-final/build-base/python-2.4
--build-lib=/home/moo/Zope-2.9.7-final/build-base/python-2.4/build-lib
--build-scripts=/home/moo/Zope-2.9.7-final/build-base/python-2.4/build-scripts
--build-temp=/home/moo/Zope-2.9.7-final/build-base/python-2.4/build-temp
running build
running build_py
error: package directory
'build/lib/linux-i686-2/5/pytz/zoneinfo/Antarctica' does not exist
make: *** [build] Error 1

Any ideas?


You don't have your system time zone set to Antarctica do you?

   --jcc

--
Building Websites with Plone
http://plonebook.packtpub.com

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

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


Re: [Zope] Zope product update question

2006-04-20 Thread J Cameron Cooper

Cyrille Bonnet wrote:


I have a question regarding product update.

I have updated a product (ATContentTypes) on the file system. Upon 
restarting the server, the new version of the product appears in red in 
the QuickInstaller (as expected).


Even though I haven't re-installed the product, some changes are picked 
up (for instance, it uses the new schemata for ATDocument).


Is this the expected behaviour?


Of course. Whatever Python code exists will take effect whenever it's 
loaded.


What is exactly the difference between a non-installed product on the 
file system and an installed product?


Is the only difference that the Install.py is run when you install the 
product??


Yes. Many Products require changes in the ZODB; QI is how this is 
accomodated.


This is really a CMF/Plone question, btw. Better on one of those lists.

--jcc

--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] same object in different containers

2006-04-11 Thread J Cameron Cooper

gf wrote:


Hi,
I am interested in having the same object appear as the child of two
different containers. These containers may distant from each other in
the object hierarchy.
In particular, I autogenerate a list of subtopics (child folders) for
several areas of my website, but would like a certain folder to appear
in more that one listing because it can be classified in multiple
ways.
Is there a way to accomplish this? Is there anything in Zope like a
symbolic link? 



As I recall, there's PortableHole and a few others. Look at zope.org.

--jcc

--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] calling a product with xmlrpc

2006-04-11 Thread J Cameron Cooper

Reinoud van Leeuwen wrote:

On Tue, Apr 11, 2006 at 01:43:22PM -0500, Floyd May wrote:


Paul Winkler wrote:


On Tue, Apr 11, 2006 at 05:54:35PM +0200, Reinoud van Leeuwen wrote:


[...]
This however generates a NotFound Exception :-(


I'm not sure why you get NotFound, but one thing I spotted is that
anything you want to publish in zope 2 must have a docstring.



I've ran into situations where lack-of-docstring results in a NotFound. 
  Not saying that this is the sole culprit of the trouble, but it's 
certainly worth knowing.



Thanks! that did it!

Is this a bug or a feature? I would expect something else in the errorlog 
(or a warning in the eventlog)


It's fundamental Zope security. Old as the hills.

I'm sure it's in the Zope book.

--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] How to do this trick..

2006-03-27 Thread J Cameron Cooper

Jason C. Leach wrote:

I'm wondering how I can do this little trick (sp_info is a globaly 
devide var, it's a dictionary obj):


option tal:repeat=group groups/existing/high
tal:content=group
tal:attributes=onmouseover string:doTooltip(event, 
'${sp_info/${group}/common_name}') 
   onmouseout=hideTip()

/option

So based on my the value of 'group' from my repeat, I want to use the 
value to look up another value in a different dictionary.  It works if 
I do this:  (event, '${sp_info/whatever/common_name}') but does not 
like me using the embedded ${group}. 


The ${var} syntax is only for inserting a value in a string expression. 
Path expressions only take known names. If you want to look up a value 
based on a variable, you must use Python. Look at the first half of this:


http://plone.org/documentation/how-to/addContentProgrammatically

  --jcc

--
Building Websites with Plone
http://plonebook.packtpub.com

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

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


Re: [Zope] Zope Managed Server

2006-03-11 Thread J Cameron Cooper

Dan Gaibel wrote:

Hello Folks,

I'm interested in finding a company that will do monthly managed zope
hosting. We're looking for a dedicated machine. I know that Zope Corp does
this and it is quite expensive. I wonder if anyone has had any experiences
with such a service.

Any advice is highly appreciated, and I apologize if this list is an
inappropriate venue to pose such a question.


There are a number of these companies around. iMeme and Zettai come to 
mind. I'm sure there are more nowadays.


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

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


Re: [Zope] Re: Advice needed before settling on Zope

2006-03-06 Thread J Cameron Cooper

Lennart Regebro wrote:


On 3/6/06, Rainsford, David [EMAIL PROTECTED] wrote:
 


I never said thanks to all you guys for your advice - it all came in
very useful.  In the end though, I have decided to go with another
system, Knowledge Tree.  The reason is that a) it's written in PHP, and
all of us developers are fluent in PHP whereas there is going to be a
learning curve with Python, and Zope.
   



Python has no lurning curve. It's more of a lurning slope. Downhill. ;-)
But Zope has one, admittedly.


As the old joke goes, it's a Z shaped learning curve.

  --jcc

--
Building Websites with Plone
http://plonebook.packtpub.com

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

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


Re: [Zope] TAL tutorial

2006-03-06 Thread J Cameron Cooper

John Poltorak wrote:

Can anyone point me to a good TAL tutorial for people who have difficulty 
getting to grips with it?



http://www.zope.org/Documentation/Articles

  --jcc

--
Building Websites with Plone
http://plonebook.packtpub.com

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

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


Re: [Zope] how can i the height of a image

2006-02-25 Thread J Cameron Cooper

Alain Barbason wrote:

hi,

in a file  index_html, I search to have the height of a image, but this,
is in a subdirectroy called images

After a request of a database, I have the name of the image in a
variable nom

if I write

 dtml-var expr='images.'+nom+'.height'  the result is

   images.x0y0.height

(x0y0 is the name of my image,)

if I write

 dtml-var expr='images.x0y0.height'  the result is

275

ok, it's the height of my image

how to make to have the first sentence, but with the result is 275 ?


See top of http://plone.org/documentation/how-to/addContentProgrammatically

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

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


Re: [Zope] want to use external script to read a text-file and image in database and modify REQUEST

2006-02-25 Thread J Cameron Cooper

Allen Huang wrote:

Hi
 
I want to use external methods to read a text file and image in database 
and modify the REQUEST
 
my code looks like this varible

---
def imageSetup(self, imageID, dataID, REQUEST):
import PIL.Image
from StringIO import StringIO
 
# Get the original image and data in memory.

image=getattr(self, imageID)
imageData=getattr(self, dataID)
imageFile=StringIO(str(image.data))
imageDataFile=StringIO(str(imageData.data))
# open image and data file
im = PIL.Image.open(imageFile)
tfw = open(imageDataFile, r)
 
# assign data coordinate and image size to variables

imX,imY = im.size()
rX=float(tfw.readline())
tfw.readline()
tfw.readline()
rY=float(tfw.readline())
mnX=float(tfw.readline())
mnY=float(tfw.readline())
mxX=mnX+imX*rX
mxY=mnY+imY*rY
 
# assign variables to REQUEST

REQUEST.set('resX', rX)
REQUEST.set('resY', rY)
REQUEST.set('minX', mnX)
REQUEST.set('minY', mnY)
REQUEST.set('maxX', mxX)
REQUEST.set('maxY', mxY)
REQUEST.set('pixelX', imX)
REQUEST.set('pixelY', imY)
--
but all I get is this
 
zope coercing to Unicode: need string or buffer, instance found
 
and the REQUEST variable is unchanged
 
I'm still new to external scripting so I don't know what the problem is

(and I think there is a lot of it here)
 
so, could someone help me out??


It's likely that you're passing an object to a method that wants a 
string (probably an id). Without a traceback, it's impossible to say more.


Are you sure that the things you're passing in as ids are really ids and 
not the objects themselves?


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

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


Re: [Zope] Can Zope 2.9 Coexist With Zope 2.6 Using Different Ports?

2006-02-22 Thread J Cameron Cooper

Mark, Jonathan (Integic) wrote:

My website GoodbyeJim.com currently runs Zope 2.6 on Red Hat 7.3. I 
have installed Zope 2.9 to use port 3200 instead of 80.


Does Zope 2 support running two separate instances of two versions of 
Zope on different ports? I have been able to run Zope 3 concurrently 
with Zope 2.6 without problem.


When I run bin/runzope in my Zope 2.9 home directory I get the 
following error on lock_file.py line 60:


IOError: [Errno 13] Permission denied: '.../Data.fs.lock'


I don't know if this is your problem, but you can't run two instances of 
the same ZODB unless you use ZEO. (That's my guess, but it depends on 
how you've installed things.) But it's certainly possible. I have at 
least three different versions of Zope and at least a dozen different 
instances on this machine right now.


   --jcc

--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] about zope and mouse event handling

2006-02-10 Thread J Cameron Cooper

Floyd May wrote:

On 2/10/06, Tino Wildenhain [EMAIL PROTECTED] wrote:


... maybe if there is a chapter about
image manipulation on the fly with PIL (python imaging lib)



I believe that Plone (or Plohn as it seems to be called by Zope people
;-) )


If by Zope people you mean Chris Withers.

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

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


Re: [Zope] Re: major problems placing authentication on an extranet site-security flaw?

2006-02-10 Thread J Cameron Cooper

michael nt milne wrote:
Well I said it was over and out but I have to respond to this latest 
post. I appreciate the help here and will be trying out some of the 
suggestions. Basically though, Zope permissions and security could be 
made a lot more usable. It's far too technically focused and this is the 
opinion of a few others as well. The whole ZMI interface could be put 
through a usability re-design to be honest and that's not even to 
comtemplate the security areas.


The ZMI is well known to be geeky. For developers, by developers might 
be its motto. If you have some concrete suggestions, by all means put 
them forth. Patches are even better.


Anyway, ACLs are ACLs. And if you don't know what you're doing, you can 
get into trouble real fast. Ever tried managing file security on a 
Windows machine with ACLs?


CMF (this includes Plone) provides a way to manage this complexity: 
workflow states. Each workflow has a set of permissions it manages, and 
a setting of these for each state. This is much more easily comprehended 
than infinite fiddling with the ZMI Security tab.


Also, as I recall, there was a private plone site howto on plone.org; 
dunno what happened to it.


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

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


Re: [Zope] Help with a simple DMS

2006-02-07 Thread J Cameron Cooper

Joshua Gilbert wrote:

Hi.

I'd like to make a simple DMS, users upload their
PDFs/docs/ps/whatever and then they can search within the documents.


I believe TextIndexNG will index contents of complex file types.


I need to be able to automate the submission of documents as I'm part
of a large research lab, we've accumulated a lot of papers over the
years.


What exactly does automate the submission of documents mean?


Other than that I'd like a nice, simple authentication scheme. That's
about it. Dead simple.


Then stick with how it's already set up. Plone provides a nice UI for 
user management.


--jcc

--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] Help with a simple DMS

2006-02-07 Thread J Cameron Cooper

Joshua Gilbert wrote:

On 2/7/06, J Cameron Cooper [EMAIL PROTECTED] wrote:


Joshua Gilbert wrote:


Hi.

I'd like to make a simple DMS, users upload their
PDFs/docs/ps/whatever and then they can search within the documents.


I believe TextIndexNG will index contents of complex file types.


OK, that's great. Where do I find documentation to tell me how to set
up the site?


According to http://opensource.zopyx.biz/OpenSource/TextIndexNG3

Ready-for-Plone (refer to installation notes in doc/README.txt)


I need to be able to automate the submission of documents as I'm part
of a large research lab, we've accumulated a lot of papers over the
years.


What exactly does automate the submission of documents mean?


I mean that I have a great deal of papers. I can't go through web
forms to add all of these documents. I would like to be able to submit
them through an automated process, I can't go through web forms by
hand to add them all.

I'm trying to convince my lab that this is a useful product. If I ask
them to submit their papers one at a time I'll lose the argument and
we won't use Zope.


Use WebDAV, FTP, or Enfold Desktop. There are other methods, but these 
are easiest.


--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] zodb queries, importing and exporting

2006-01-25 Thread J Cameron Cooper

Jonathan wrote:
Not a zope question, but... why don't you create a mutually agreed upon 
XML DTD (document type definition) that represents the content of a 
database record.  Then each party can implement the XML data 
extraction/upload to their own db technology as they please.


Each db operator will send/receive data in the agreed upon XML format 
(that's what its for!).


If you use ATXML (see the Marshall product) you can even 
marshall/demarshall the files directly to/from your objects via 
FTP/WebDAV. No intermediate representation.


--jcc

- Original Message - From: Cliff Williams 
[EMAIL PROTECTED]

To: zope@zope.org
Sent: Wednesday, January 25, 2006 11:23 AM
Subject: [Zope] zodb queries, importing and exporting





LEAD UP:
I've got a site that I need to develop and it's a natural and obvious 
decision that I use zope and plone as they are what I'm familiar with 
and what I prefer to other CMS/Portal-wares out there. The site will 
have several counter parts around the globe being administered by 
various individuals, not all of whom are enlightened enough to realize 
the folly of using anything other than zope.


MEAT OF THE ISSUE:
The sites will be tracking dance clubs. We'll be building Types in 
plone (Using Archetypes) to track information about clubs locally. 
Each site will potentially have different database technology from the 
other sites. I know of 3 admins who are planning on using PHP-* + 
MySQL and a few others who want to use Postgress and some other front 
end.


We want to be able to integrate the information from any one site into 
any other site with respect to the club objects in the disparate 
databases. I'd like to leverage the simplicity of zope's 
application/database model and not use SQL storage if possible but 
don't know how I can be able to share with my counterparts who are 
bent on using relational databases.


We do not intend to leave open connections to each other's database 
servers. The consensus is to do scheduled dumps and push the files to 
the other admins who would have their own routines for integrating the 
data into their site. I really don't want to have to set up an SQL 
server.


Any help/suggestions would be greatly appreciated.

--Cliff

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



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





--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] Can one nest macros with slots?

2006-01-25 Thread J Cameron Cooper

Doyon, Jean-Francois wrote:

I can't seem to do this:

use-macro
  fill-slot
define-macro
  ... Some html ...
  define-slot/define-slot
  ... Some html ...
/define-macro
  /fill-slot
/use-macro

Allowing me to nest multiple reusable templates?

I have objects with common interfaces which could easily share templates ...
If I could do this! (The shared template still needs to endup in the
master template).

Or are there other techniques to achieve this?


Macros are decided at compile time so that you can ask a template (which 
is not called) for its macros::


  here/main_template/macros/master

The code above would have macros being created in some other template at 
the time this macros is used, and I cannot imagine how they would be 
available.


Why is a macro with whatever uses your common interfaces not suitable? 
You scenario is too vague for any other advice.


--jcc

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

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


[Fwd: Re: [Zope] Structured Text Question]

2006-01-25 Thread J Cameron Cooper

Asad Habib wrote:
Well, this decision was not made by me and I cannot override it. Given 
that I have to use Structured Text, is there a solution to this problem?


You can always write HTML in STX. Just say::

 br /

Or maybe::

 p/p

I would suggest, however, not setting a solution in stone until you know
it meets your requirements.

--jcc


On Wed, 25 Jan 2006, Jaroslav Lukesh wrote:


Is there any way to have multiple lines of empty space between two
sections of text in a Structured Text document? I looked on Google 
but did

not find any answers to this question. However, I did notice that others
had asked the question as well. Is this a shortcoming of Structured 
Text?

Any help would be appreciated. Thanks.



Why?

Use stylesheets or fulltext replacement of some shortword to DIV with
appropriate geometry.


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

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


Re: [Zope] TinyMCE

2006-01-24 Thread J Cameron Cooper

Garito wrote:

Chris Withers escribió:


Garito wrote:

Don't like kupu because is very difficult to install and very very 
difficult to use



I find that a suprising statement...

What problems did you experience?

cheers,

Chris


Hi, Chris!
I ask to the list some months ago but no solution was proposed (at least 
not a good one for me)
I try to install it and use but the behavior of kupu is, in my opinion, 
unacceptable for my needs


I'm working on a framework where the most important question is easyness 
and kupu doesn't meet these condition


I need a WYSIWYG editor to override some TextAreaField from Formulator 
to render WYSIWYG


Kupu is hard to install and hard to configure like I need

For that, I'm waiting for someone who need something like me or do it 
for myself when I have a moment free


I think they'd really like details. What problems do you encounter on 
install? What sort of configuration do you want to do that is difficult?


I'm afraid easiness is not set explicitly.

--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] returning list from PythonScript

2006-01-20 Thread J Cameron Cooper

Slobodan Jovcic wrote:

Hi,

I'm trying to pass a list of values between the script and external  
method. ZPT contains the following:


tal:block tal:define=whatever python: container.myExtMethod ( 
container.myScript() ) /


container.myScript() is a Python Script that returns a list of values.
container.myExtMethod() is an External Method expecting that list.  
However, all it gets is a string representation of the list ( []  
instead of [] ). How can I pass the list itself?


Btw, hard-coding list in ZPT works fine:
tal:block tal:define=whatever python: container.myExtMethod( ['a',  
'b', 'c' ] ) /


The problem is likely in 'myScript', which you do not show us.

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

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


Re: [Zope] Newbee interfaces and implementations

2006-01-19 Thread J Cameron Cooper

Roman Klesel wrote:

bruno modulix schrieb:


So you recommend that I should just skip them as long as I'm on Zope2?



Short answer :  yes. Unless you plan to switch to Zope3 really soon, but
then, I'd recommand that you skip Zope 2.x !-)



No, I'll be with Zope2 for a while. I'm running an Plone site too and dont't
have the memory to run a second Zope3 instance.

I think my question is answered and I'm a little less confused now. :-)

When I heard the word interface I thought of something like a network 
interface,
which is the communication gateway to the entire machine if you address it from 
network:

- you physically connect it to the network by plugging a cable into the NIC
- you address it by calling an address which is assigned to the NIC.

actually all other devices on the network only see the target machine as a 
network interface
and don't know what kind of system it is plugged into until the methods the 
interface provides
trigger routines that reveal more information.

So, now I understand that interfaces in a the Zope2 context have some different 
meaning.


It a programming context, really. You should think of programmatic 
interfaces like the interface between a power supply and a power 
consumer: as long as both agree that the plug should have an end like 
such, and the socket should look so and so, and the voltage is this, it 
doesn't really matter what's generating the power, what's consuming the 
power, or how the plug or socket is made.


--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] problems displaying radio buttons in plone

2006-01-12 Thread J Cameron Cooper

Jon Savian wrote:

Hi guys, i am using plone 2.1.3 and i am having some trouble
displaying radio buttons.  I am doing a normal html form
forminptut type=radio etc  However they do not display
on the page.  Any ideas?


What do you mean by doing?

Plone doesn't by default allow things like forms in content. There's a 
safe HTML howto on plone.org, I think, that you should look at in this 
case.


Also, there's a Plone-specific mailing list, you know.

--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] newbie dtml-in question objectValues

2006-01-11 Thread J Cameron Cooper

Alric Aneron wrote:

 Hello,
I am trying to find how to get the relative path of an object.  If i do:
dtml-in objectValues('DTML Document')
   dtml-var URLPATH0
/dtml-in

URLPATH0 does not give me the relative path of the objects interated, 
but rather the path of the object doing the iterating (my method). I 
want the path of every DTML Document the loop encounters.  absolute_url 
works, but it puts in the undesired filename and http://; in front 
etc.


Ask yourself: where does URLPATH0 come from?

When you know that, you will answer your own question.

--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] Where oh where is Repozo

2006-01-11 Thread J Cameron Cooper

Jonathan Cyr wrote:

Um,

Where is the latest version of Repozo, the backup tool, kept?

Is there a reason, that it's not included with the Zope 
install/utilities (at least the 2.7.x I'm using).


I confess, I've been stopping my zope, and tar'ing the directories 
so now I want to clean up my act and use Repozo... and I'm having 
difficulty finding it in Google, Zope.org.


BTW, there is an excellent explanation of Repozo in two places,

http://www.zope.org/Wikis/ZODB/FileStorageBackup

http://www.plope.com/Members/chrism/repozo

but neither have links to a source/repository.

It also says here, that repozo is included with Plone, but not with 
Zope... h


I find Zope to be super stable, with zero corruptions of any kind, and 
no need to ever restore a backup... but lightning may strike, and I've 
gotten away with poor backup disciplines long enough.


A URL would be much appreciated.


$ locate repozo
/home/jccooper/zope/Zope27/bin/repozo.py
/home/jccooper/zope/Zope-2.8.3-final/utilities/ZODBTools/manual_tests/testrepozo.py
/home/jccooper/zope/Zope-2.8.3-final/utilities/ZODBTools/repozo.py
/home/jccooper/zope/Zope-2.8.3-final/build-base/python-2.3/build-scripts/repozo.py
/home/jccooper/zope/Zope283/bin/repozo.py

Also:

http://svn.zope.org/ZODB/trunk/src/scripts/repozo.py?view=log

--jcc

--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] RE: Java vs Zope

2006-01-03 Thread J Cameron Cooper

Sam Stainsby wrote:


One thing is static type checking: developers detecting type errors at
compile time, rather than some hapless user running into it at run time
(i.e. after release to the public). I see many of those types of errors
in Zope and Plone products, particularly as the API of one product
changes and another product tries to use it. With Java, such
problems are likely to be detected at compile time. Runtime errors produce a 
negative public
perception of software products, as well as being dangerous in critical
systems. Pervasive use of unit testing will help avoid such problems, but
that level of discipline is hard to find in Zope/Plone projects (but well
done those who do it!). On the downside, static type checking makes Java
less flexible, and requires more programming effort, and of course there
is that tedious compilation step.


I worked in Java for web apps (as well as a few halting tries at 
GUIs--ick!) before Zope. I expected type problems because of the lack of 
static checking; however, I have not found it to be a problem. I don't 
think programs are quite as wild and wooly as static typed languages 
assume. I think it's quite acceptable to put the burden of use on the 
programmer instead of the compiler, considering the benefits; that's 
what he's thinking about anyway, no?


My main problem with Java is that it's a high-friction environment. It 
takes a lot of work to do most things, often because interfaces have 
been abstracted so far (or sometimes because of compiler hoops, but not 
that often.) This is both in code and framework.


For code, go take a look at what it takes to make an XML-RPC call in 
Python and in Java. I had to look this up for writing my book, and it's 
quite disgusting. It all depends on the functionality, of course, but I 
can't think of anything that writes quicker in Java than in Python.


Framework-wise, I found that it took at least three separate helper 
programs to set up an reasonably productive, understandable, and 
maintainable development environment for J2EE, and that's not even 
counting an IDE.


Zope 2 development generally has a lot less friction, and is usually a 
lot higher-level. As a result, I think it's several times faster than 
Java development. Possibly even many times faster. It does seem to make 
up for this by being more mysterious, but you can learn those things in 
time. You can't get rid of all the Java crap. (It's like the Churchill 
joke.)


Zope 3, though I admit I've only played with it glancingly, seems to be 
more J2EE-like in certain respects: there seem to be a lot of things I 
have to touch to get things going. To a certain point, I can deal with 
this, but if there's ever a ZDoclet...


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

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


Re: [Zope] Please help with DTML-in (newbie)

2005-12-28 Thread J Cameron Cooper

Alric Aneron wrote:

 Hello, I am new to Zope and DTML.
I am trying to use a python script to call a Z SQL method.  The python 
script also has a list that dtml-in inside the ZSQL method interates 
over. so my python script:

-python script
words = ['one', 'two']
context.REQUEST.set('wordlist', wordlist)
rs = context.myzsqlmethod()
return rs[0,2]
-z sql script:
SELECT * FROM table
WHERE
dtml-in words
column1 LIKE ('dtml-var '%'+sequence-item+'%'' OR
column2 LIKE 'dtml-var '%'+sequence-item+'%'') dtml-unless 
sequence-end AND /dtml-unless

/dtml-in
---
But it doesn't want to, gives me..
*Error Type: NameError*
*Error Value: name 'wordlist' is not defined

*I tried feeding the variable into the ZSQL arguments list, but i got 
something like cannot concatenate a module with a str

Can anyone please help me?
Thank you!


It complains about 'wordlist' because it is not defined anywhere. 
Perhaps you mean 'words' in the second line?


To pass a param to the ZSQL method, just say::

   context.myzsqlmethod(words=words)

This will put it in the namespace.

--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope-dev] [RfC] Removal of old stuff in Zope 2.10

2005-12-22 Thread J Cameron Cooper

Dario Lopez-Kästen wrote:

Chris Withers wrote:


Andreas Jung wrote:


I've never met ppl who actually used the HelpSys so that's why I am 
raising the question about the value of the HelpSys. Lots of my 
co-workers work with Zope on different levels (scripters, product 
developers)...I've always pointed them to the Zope Book...the HelpSys 
was never a topic.


I most commonly use the HurtSys for DateTime's api, and some of the 
idnexing apis. That said, I also agree it should die if something 
nicer comes along ;-)


I use it a lot, and like Chris, for the DateTime stuff, but also for 
looking up how to manage properties, etc. It is/was a big help for me 
(more so than the zope book, at least when I was learning Zope) when 
learning stuff and looking up things.


One difference I perceive (YMMV) between the Zope book and the Online 
help is that the online help is more of a renference than the Zope book.


I think my point is that it is an added value if there is an online help 
available that does not require a live connection to the internet every 
time you need to look something up.


So +1 on killing the current helpsystem and +1 on replacing it with 
something nicer :-)


The online help reference for ZPT is quite good (and DTML as well), and 
before I knew ZPT well I used it a lot. I still look there occasionally 
for minor API things (like property managers and DateTime), though 
obviously this is also at various web-based sources. DocFinderTab is 
generally superior, save for those objects and technologies that are not 
persistent objects, or are not described well by the API (ZPT and 
DateTime, for instance.)


Also, I too use Gadfly frequently in training (and also when I was 
learning Zope), and it's fantastic that it's already there and usable. 
Installing MySQL or Postgres and an adapter is absurdly complicated with 
multiple people with multiple operating systems. I suppose a simple 
downloadable Product would be okay, but what burdens is that easing?


--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com
___
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] [RfC] Removal of old stuff in Zope 2.10

2005-12-22 Thread J Cameron Cooper

Dario Lopez-Kästen wrote:

Chris Withers wrote:


Andreas Jung wrote:


I've never met ppl who actually used the HelpSys so that's why I am 
raising the question about the value of the HelpSys. Lots of my 
co-workers work with Zope on different levels (scripters, product 
developers)...I've always pointed them to the Zope Book...the HelpSys 
was never a topic.


I most commonly use the HurtSys for DateTime's api, and some of the 
idnexing apis. That said, I also agree it should die if something 
nicer comes along ;-)


I use it a lot, and like Chris, for the DateTime stuff, but also for 
looking up how to manage properties, etc. It is/was a big help for me 
(more so than the zope book, at least when I was learning Zope) when 
learning stuff and looking up things.


One difference I perceive (YMMV) between the Zope book and the Online 
help is that the online help is more of a renference than the Zope book.


I think my point is that it is an added value if there is an online help 
available that does not require a live connection to the internet every 
time you need to look something up.


So +1 on killing the current helpsystem and +1 on replacing it with 
something nicer :-)


The online help reference for ZPT is quite good (and DTML as well), and 
before I knew ZPT well I used it a lot. I still look there occasionally 
for minor API things (like property managers and DateTime), though 
obviously this is also at various web-based sources. DocFinderTab is 
generally superior, save for those objects and technologies that are not 
persistent objects, or are not described well by the API (ZPT and 
DateTime, for instance.)


Also, I too use Gadfly frequently in training (and also when I was 
learning Zope), and it's fantastic that it's already there and usable. 
Installing MySQL or Postgres and an adapter is absurdly complicated with 
multiple people with multiple operating systems. I suppose a simple 
downloadable Product would be okay, but what burdens is that easing?


--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com
___
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] ZSQL with different user

2005-12-20 Thread J Cameron Cooper

Pier Luigi Fiorini wrote:

Alle 18:42, lunedì 19 dicembre 2005, hai scritto:


Pier Luigi Fiorini wrote:


Hello,
I'm developing a Zope application that uses a PostgreSQL connection and
several ZSQL objects.
People should log in using a Postgres user and ZSQL object should be
executed by the user that's logged in. Multiple people can be logged at
the same time. Unfortunately it is not possible because the same Postgres
connection is used by all the ZSQL object. Is there a way to change the
user executing a ZSQL query?

An alternative would be to log into the event.log some information (like
the username, that's stored in the session) and the query source.


Your alternative is dead easy. zLOG (or, better, the Python logging
module, for which zLOG is now a facade) is quite easy to use. You can
even make your own log file to contain only such events.


I know _how_ to use zLOG. I just don't know how to log the query source.
Is there some documentation about these things. I can find only documentation 
about making things like a simple form which is not so useful because you can 
learn it in some days.


That depends. What do you mean by query source?

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

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


Re: [Zope] using tal macros in PloneArticle query

2005-12-16 Thread J Cameron Cooper

Stefan Kueppers wrote:

I am trying to use tal and metal inside of a PloneArticle instance and 
can not get it to work.

Should this not be possible?


Content is generally static, as part of the whole 
content/logic/presentation concept. I don't know about PloneArticle, but 
I doubt it's any different: the contents are not parsed by anything but 
delivered exactly as is.


If you want behavior, you need a page template. Though there is at least 
one product that provides a type that breaks the rules. DynamicContent 
or something like that.


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

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


Re: [Zope] Trapping zope exceptions in python script

2005-12-15 Thread J Cameron Cooper

Jonathan wrote:

Andreas wrote:




My 2 cents: PythonScripts are restricted and are *not* thought to be a full
replacement for Python modules. If you need this functionaltiy consider
writing a Zope Product, using external methods or using TrustedExecutables.





If python scripts are restricted from accessing zExceptions (for 
security reasons???) then why allow python scripts to trap zExceptions 
in bare try/excepts?  If the logic for not allowing zExceptions in plain 
vanilla python scripts is for security reasons, then allowing bare 
try/excepts would seem to be a security hole (though, I don't see the 
rationale for this).


I would imagine that not allowing these exceptions to be imported in 
trusted code is simply an oversight. The mechanism involved is not a 
you may not import this type of thing, but rather a you may import 
this statement. It is easy to miss safe but rarely used pieces.


If you have a list of exceptions you would like to have available, go 
and file a bug report. A patch would be even better.


--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] batching help

2005-12-15 Thread J Cameron Cooper

Nicolas Georgakopoulos wrote:

Dragos Chirila wrote:


Hi

I suggest to use the following function that

def get_grouped_list(self, seq=[], size=3):
#get the list with all items grouped
return [seq[i:i+size] for i in range(0, len(seq), size)]

that takes as parameter a list and goups items in slices with length = 
size.


 def get_grouped_list(seq=[], size=3):
... return [seq[i:i+size] for i in range(0, len(seq), size)]
...
 l = [1,2,3,4,5,6,7,8]
 get_grouped_list(l)
[[1, 2, 3], [4, 5, 6], [7, 8]]
 get_grouped_list(l, 4)
[[1, 2, 3, 4], [5, 6, 7, 8]]


Then iterating this is something like:

tr tal:repeat=slice python:someobject.get_grouped_list(yourlist)
td tal:repeat=item slice
span tal:replace=item /
/td
/tr

Nicolas Georgakopoulos wrote:

Hello all , I'm trying to display on the same page a table with (3 
columns) with content from a list . I'm trying to batch the results 
so that every 3 elements anothe row is created.

Can anyone give me a clue how to do that ?

this is my code:


table tal:define=Rnumber 
python:context.cm1.content.specialfile.getList('link_list') ; batch 
python:modules['ZTUtils'].Batch(Rnumber,size=3,start=0)

   th colspan=3Main Title/th
   trthTitle 1/ththTitle 2/ththTitle 3/th/tr
   tr
   td tal:repeat=num batch
   span tal:condition=python:num  3 
tal:replace=structure num content goes here.. /span

   /td
   /tr !--  tr
   td tal:repeat=num batch
   span tal:replace=structure num 
Material goes here /span

   /td
   /tr 
-- /table
Thanks for your suggestion Dragos , I want to do it the zope batch way 
(I suppose it is simpler) if I can...

I will keep in mind your function if nothing else can be done.


The ZTUtils batching is mostly for batching between pages. It's probably 
easier to do it in a Python script.


--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] Re: [Zope-dev] user folder question

2005-12-15 Thread J Cameron Cooper

On 15 Dec 2005, at 16:58, Chris Cole wrote:

I'm currently trying to setup a custom zope instance for our c.s.
department at school. Currently we run a totally linux infrastructure
with ldap authentication which we would also like to tie into zope. My
question is not how to authenticate against ldap, but I was  wondering if
there is a way to disable the default user folder and in automagically
put an ldapuser folder  in its place on creation of a new instance.  I'm
kinda new to zope, and I'm sure it's possible, but if someone could at
least point me in the right direction i would appreciate it.


If you do replace the top user folder with one that depends on an 
outside source, you better learn how to use the Emergency User. 
Because you will at some point mis-configure the LDAPUserFolder and lock 
yourself out.


--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] Trapping zope exceptions in python script

2005-12-14 Thread J Cameron Cooper

Jonathan wrote:
Thanks to everyone for the feedback... the bottom line seems to be that 
you can NOT trap zope exceptions in a python script... which seems a bit 
odd.


Of course you can. You just are restricted from importing certain 
things, which happens to include this class of exception. Probably it is 
safe for Zope to allow importing this in restricted code; feel free to 
file a bug report.


But you have easy avenues to deal with this: either declare that class 
safe for import or take a couple extra seconds and write it in an 
External Method.


--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] Recursive Display Of All Folder Items

2005-12-13 Thread J Cameron Cooper

Francisco Chamorro wrote:
Hi everyone, I am trying to get a dump of all the content currently in 
our zope server.  Using DTML I was able to get the top level folders to 
display their content but I am unable to recursively display the 
contents of the sub-folders.


This is the code I am using for my top level folders, where TV is the 
name of the folder I want to display.


dtml-in TV.objectValues()dtml-var idbr/dtml-in


My second attempt at displaying sub-folder content was the following:

dtml-in TV.objectItems()
id: dtml-var id,br
type: dtml-var meta_typebr
dtml-if meta_type=='Folder'
dtml-in expr=objectValues(dtml-var id)
id: dtml-var id,br
type: dtml-var meta_typebr
/dtml-in
/dtml-if
/dtml-in

But that also fails.  I searched the documentation and found a post 
about recursively calling the same function but that did not work as I 
get a excessive recursion error. Any help on this problem would be 
greatly appreciated.


objectValues is acquired on all objects, even non-folderish ones. Thus 
recursion never stops. You must ask for it explicitly: 
aq_inner.aq_explicit or something like that if I remember directly.


--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] Zope and Image display

2005-12-13 Thread J Cameron Cooper

tyson wrote:

Hi-
 I have a dtml form that loads a binary image from a python script.  
This works fine with no problems, but I want to return the image and 
also some other data as well.  The only thing is when I return the 
information in the form of a list, my image won't load.  I think that 
the list automatically changes the binary image into a string or 
something. Does anybody know about this or some work around by any chance?


The data that defines an images cannot be placed in HTML. The webbish 
way of doing things is to link to an external resource, which is what 
the 'src' in an 'img' tag is all about.


You may return an image from a Python script, but since you have to tell 
your web browser Hey, that there resource is an image, go fetch it it 
cannot work to return anything but the binary data.


--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] zope and LDAP for authorisation

2005-12-13 Thread J Cameron Cooper

Marinussen, M.J. (Ria) wrote:


Hi,

I'm looking for a zope product that enables me to use our Active
Directory LDAP server for verification of login credentials only.
I want users still stored in Zope, and access to directories should be
also something I can handle in Zope, and I don't want to use LDAP groups
because I don't control the LDAP server and there are no groups on the
LDAP server I can use.

So really, all I want is that Zope checks the passwords with the LDAP
server instead of with it's own userfolder.
And perhaps, a possibility to check/search for the available loginnames
on the LDAP server when adding a user to the userfolder.

I've checked out LDAPUserFolder but that's not what I'm looking for (I
think...).

Does anyone know whether there is such a product, or give me some
poiners to adapt an exisiting product to my needs?


There is an LDAPMultiplugin for PluggableAuthService, which might make 
this easier. It could be as easy as installing LDAPUF in PAS and turning 
off all its interfaces except for the auth one.


However, I don't quite see how you would store users in Zope and then 
ask for the password in LDAP on a one-to-one basis. Seems like you're 
relying on an accidental correspondence between ZODB-stored user names 
and LDAP user names.


   --jcc

--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] checking for elements in a list

2005-12-03 Thread J Cameron Cooper

Christopher Rivard wrote:

Hello,

I'm am trying to check for the membership of items in a list and think 
I'm missing something.

How is this done in dtml?

List allids: [15,16,17,18]

Check for multiple items in the list:

dtml-in allids prefix=loop
dtml-if expr=loop_item == 17
something
dtml-elif expr=loop_item == 17 and loop_item != 18
doesn't work
/dtml-if
/dtml-in

The goal is to check for combinations:
17 and not 18
18 only
17 only
17 and 15
18 and 16
...combinations.

I don't think that I really want to loop through the list, just want to 
check membership in the list.


In Python, you can simply ask::

  17 in allids

  18 not in allids

and so forth as boolean expressions.

Just make sure that the elements of the list you're getting are what you 
think they are. If you ask about the integer 17 and the list actually 
has a string 17 they won't match. You can either adjust what you test 
or use something like the 'int' function to cast.


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

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


Re: [Zope] Creating a DTM Document in a variable folder.

2005-11-30 Thread J Cameron Cooper

Jonathan Cyr wrote:
You might want to use index_html rather than index.html in this 
example.  The dot means other things in Python, and index.html is a 
carryover from filesystem webservers.  My impression is that the 
acquisition mechanism doesn't like ids with a dot, in some circumstances.


Not trying to nit-pick, just got hung-up on that item myself once before.

...or maybe that's not true anymore and has been allowed for...


That just means you can't traverse to it with attribute notation. For 
instance::


 self.plone.index.html

will not look for 'index.html' but rather the 'html' inside 'index'.

Same goes for dashes::

 self.plone.try-me

will try to subtract the value of the 'me' variable from the value of 
'self.plone.try'. But usually it will fail in trying to look up the 
first value.


In such cases, you can use subscript notation::

 self.plone['try-me']

or getattr (which doesn't use acquisition.)

--jcc


Peter Bengtsson wrote:


folder = getattr(context, 'b')
adder = folder.manage_addProduct['OFSP'].methodAdd
adder('index.html', 'Some title')

That creates it with default content. To change it you'll have to call
dtmlm = getattr(context, 'index.html')
dtmlm.manage_edit(bla bla bla bla bla, 'Same title')
# or
f = open('/tmp/foobar.html')
dtmlm.manage_upload(f)




On 11/25/05, Martin Koekenberg [EMAIL PROTECTED] wrote:
 


Hello,

I don't have any Python experience yet, so who has a solution for this
'problem'.

Example:

I 've 3 folders a, b  c.
I want to create a dtml document in a folder by a form. The folder is a
variable in my form.
The formis no problem, the form action is no problem. The python script to
craete that document is my problem.

How can I create a DTM Document in a variable container ?

Regards,

Martin Koekenberg

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

 



--
Jonathan Cyr
http://www.cyr.info
http://www.weddingweblog.com
[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 )



--
Building Websites with Plone
http://plonebook.packtpub.com/

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-PAS] Five interfaces

2005-11-17 Thread J Cameron Cooper

The trunk currently says in PluggableAuthService.py::

 try:
 from OFS.interfaces import IObjectManager
 from OFS.interfaces import ISimpleItem
 from OFS.interfaces import IPropertyManager
 except ImportError: # BBB
 from Products.Five.interfaces import IObjectManager
 from Products.Five.interfaces import ISimpleItem
 from Products.Five.interfaces import IPropertyManager

I think this is supposed to support Zope 2.7 and 2.8 interfaces. 
However, I don't see any of the first three imports existing in Zope 
2.7. (Or, at least, 2.7.4.)


I haven't tested this myself, but do have a report of it not working.

Am I missing something?

--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

Enfold Systems, LLC
http://www.enfoldsystems.com

___
Zope-PAS mailing list
Zope-PAS@zope.org
http://mail.zope.org/mailman/listinfo/zope-pas


Re: [Zope] Passing Parameters to External Methods

2005-11-16 Thread J Cameron Cooper

Asad Habib wrote:
Hello. I am trying to use the Python version of the PHP script written 
by Jason Rust called 'HTML_ToPDF.php'. I have represented this script 
using an External Method since it uses functions, such as open, which 
cannot be used in Zope Python scripts for security reasons. The python 
code for the script consists of a class definition and so I have had to 
create a python function which instantiates an object of this class. 
However, I am having toruble passing parameters to this function which 
are needed by the class constructor to instantiate an object of this 
class. Can parameters be passed to external methods? Whenever I try to 
pass parameters to function 'createHtmlToPdf', Zope returns an error 
stating that no such function exists. Other on the hand, if I pass no 
parameters this call is successful but the init function fails 
complaining that three parameters are expected. I have provided a 
snippet of my code below. Any help would be greatly appreciated. Thanks.


 def createHtmlToPdf(in_htmlFile, in_domain, in_pdfFile):
return html2pdf(in_htmlFile, in_domain, in_pdfFile)

Functions in external methods generally start with the 'self' parameter. 
Your description of the error messages doesn't entirely support my 
supposition, but you could try it.


--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] Passing Parameters to External Methods

2005-11-16 Thread J Cameron Cooper

Asad Habib wrote:

Hi Cameron. You are right but the self parameter is implicitly passed.


It is implicitly passed, but must be explicitly defined::

 def createHtmlToPdf(self, in_htmlFile, in_domain, in_pdfFile):
return html2pdf(in_htmlFile, in_domain, in_pdfFile)

When you say::

   context.createHtmlToPdf(in_htmlFile, in_domain, in_pdfFile)

Python ends up calling this method/function something like::

   createHtmlToPdf(context, in_htmlFile, in_domain, in_pdfFile)

Your message signature must agree.

--jcc


On Wed, 16 Nov 2005, J Cameron Cooper wrote:


Asad Habib wrote:

Hello. I am trying to use the Python version of the PHP script 
written by Jason Rust called 'HTML_ToPDF.php'. I have represented 
this script using an External Method since it uses functions, such as 
open, which cannot be used in Zope Python scripts for security 
reasons. The python code for the script consists of a class 
definition and so I have had to create a python function which 
instantiates an object of this class. However, I am having toruble 
passing parameters to this function which are needed by the class 
constructor to instantiate an object of this class. Can parameters be 
passed to external methods? Whenever I try to pass parameters to 
function 'createHtmlToPdf', Zope returns an error stating that no 
such function exists. Other on the hand, if I pass no parameters this 
call is successful but the init function fails complaining that three 
parameters are expected. I have provided a snippet of my code below. 
Any help would be greatly appreciated. Thanks.




def createHtmlToPdf(in_htmlFile, in_domain, in_pdfFile):
   return html2pdf(in_htmlFile, in_domain, in_pdfFile)



Functions in external methods generally start with the 'self' 
parameter. Your description of the error messages doesn't entirely 
support my supposition, but you could try it.


--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )







--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] Passing Parameters to External Methods

2005-11-16 Thread J Cameron Cooper

Paul Winkler wrote:

On Wed, Nov 16, 2005 at 11:26:10AM -0600, J Cameron Cooper wrote:


Asad Habib wrote:


Hi Cameron. You are right but the self parameter is implicitly passed.


It is implicitly passed, but must be explicitly defined::

def createHtmlToPdf(self, in_htmlFile, in_domain, in_pdfFile):
   return html2pdf(in_htmlFile, in_domain, in_pdfFile)

When you say::

  context.createHtmlToPdf(in_htmlFile, in_domain, in_pdfFile)

Python ends up calling this method/function something like::

  createHtmlToPdf(context, in_htmlFile, in_domain, in_pdfFile)

Your message signature must agree.



No, it's optional.  If you don't inlude self in the signature,
it's not passed.  You can see this in the source of ExternalMethod.py:

if ((self._v_func_code.co_argcount-
 len(self._v_func_defaults or ()) - 1 == len(args))
and self._v_func_code.co_varnames[0]=='self'):
return f(self.aq_parent.this(), *args, **kw)


I think the problem lies elsewhere. Traceback?


I thought I'd seen that work before, but didn't want to dip into asides.

Oh well. There goes my guess.

--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] export/import problems with plone site

2005-11-14 Thread J Cameron Cooper

Faheem Mitha wrote:

I successfully exported/imported a Plone site from one Zope instance to 
another.


However, when I try to publish the Plone page, I experience an error.

Does anyone know what the problem is here, or what to look for?

Is this perhaps a more Plone speciific problem?


AttributeError: portlet_forum_latest (Also, an error occurred while 
attempting to render the standard error message.)


Sounds like some forum product is installed on the first instance and 
not the second.


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

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


Re: [Zope] Re: zope 2.8.4 on windows 98

2005-11-14 Thread J Cameron Cooper

Fernando Martins wrote:

Andreas Jung wrote:


On Sat, 12 Nov 2005 03:52:28 -0800, Fernando Martins
fernando at cmartins.demon.nl wrote:



I understand the problem, but is it the intention that zope is not
supported on win98?


Yes, I believe this is intentional. Windows 98 is a seven year old OS
with  insufficient infrastructure to reliably run server tasks anyway. At
least  get Windows 2000, which has a decent kernel.



However that does not mean that Zope won't run on Windows 98. For a recent
project where we ship and install Zope on all customers desktop machines I
had to do a lot of testing especially on Windows 98.



I've been using zope 2.7.4 on win 98 for some development/testing, not as a
real server.

But I'm confused by your statement: if zope 2.8.4 is calling an NT security
function, not available in win98, then it does NOT run on win98?? DO you
mean there is something wrong with my win98 setup or that zope 2.8.4 could
be patched to overcome this issue?


Probably this is just in the start sequence. You cannot, of course, run 
Zope as a service in Win98, since it understands no such thing. Quite 
possibly you can use runzope or whatever to execute it in a console.


I can't say exactly as the traceback has been edited out of this thread 
(and I've deleted the old messages).


FYI, the last time I tried Zope on Win98 was Zope 2.2.

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

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


Re: [Zope] sql access style

2005-11-04 Thread J Cameron Cooper

Vlada Macek wrote:

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

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

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

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


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

It is made for using RDBMS in Zope products.

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

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


Re: [Zope] question about stopping acquisition in VHM sites?

2005-10-27 Thread J Cameron Cooper

Gary wrote:


Hi,

How do I stop acquisition at the root of my website?
If I have two websites in zope, and I set the virtual host mapping to
www.sitea.com/websites/SiteA http://www.sitea.com/websites/SiteA
www.siteb.com/websites/SiteB http://www.siteb.com/websites/SiteB

I don't want my users to get to SiteB from http://www.sitea.com/SiteB

I am using Zope 2.7 


You can create in each site an empty Python script or something named 
like the other site(s). This is not the best solution in the world, 
since if you have more than a handful of sites, you get a combinatorial 
explosion. But, it will work.


Perhaps someone who is bothered by this problem and has time will do 
some magic in VHM (or a new type of object) to stop such traversals.


   --jcc


--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] Debugging security settings in .metadata files

2005-10-27 Thread J Cameron Cooper

Floyd May wrote:

I have a set of files - page templates, python scripts, and zsql
methods - that are set up as filesystem objects.  I'm having trouble
getting the security set the way I want it to be with the .metadata
files.  Here is the content of my .metadata files:
--8-
[security]
View = 0:Manager
Access contents information = 0:Manager
Access Contents Cnformation = 0:Manager
-8--

However, I can still access my content through an anonymous context. 
Can anyone give me some ideas about debugging my situation?  Thanks!


Zope 2.7.7-final, python 2.3.5, freebsd5
CMF 1.4.8


Looks okay to me, though I don't know what you're doing with the third line.

Check what it looks like in the ZMI. This will tell you whether or not 
the problem is in getting the permissions set like you expect.


--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] Debugging security settings in .metadata files

2005-10-27 Thread J Cameron Cooper

Floyd May wrote:

I don't know what you're doing with the third line...


Me neither, typo.



Check what it looks like in the ZMI. This will tell you whether or not
the problem is in getting the permissions set like you expect.



Filesystem objects don't have a security tab in the ZMI (or at least,
these don't).  Should one be there?


Hm. Seems they don't.

Customize it and look at the security tab of that.

--jcc


On 10/27/05, J Cameron Cooper [EMAIL PROTECTED] wrote:


Floyd May wrote:


I have a set of files - page templates, python scripts, and zsql
methods - that are set up as filesystem objects.  I'm having trouble
getting the security set the way I want it to be with the .metadata
files.  Here is the content of my .metadata files:
--8-
[security]
View = 0:Manager
Access contents information = 0:Manager
Access Contents Cnformation = 0:Manager
-8--

However, I can still access my content through an anonymous context.
Can anyone give me some ideas about debugging my situation?  Thanks!

Zope 2.7.7-final, python 2.3.5, freebsd5
CMF 1.4.8


Looks okay to me, though I don't know what you're doing with the third line.

Check what it looks like in the ZMI. This will tell you whether or not
the problem is in getting the permissions set like you expect.

   --jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )





--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] Zope/Editor problems

2005-10-26 Thread J Cameron Cooper

Lennart Regebro wrote:

On 10/26/05, Håkan Johansson [EMAIL PROTECTED] wrote:


On Oct 26, 2005, at 17:00, Lennart Regebro wrote:



On 10/26/05, Håkan Johansson [EMAIL PROTECTED] wrote:


My personal guess is that both Epoz and Kupu has hidden prereqs that
the documentation does not say, or that I simply missed somehow.


You should still get an error message.

Do you start the server with bin/runzope or bin/zopectl start?


zopectl start



OK, use bin/runzope or zopectl fg, and you will surely get the error
message. I'm a bit surprised it doens't end up in the logs as well,
but maybe that's expected.


If you don't run in debug mode the error will be written to the logs (at 
least in Zope 2.8), presumably because Zope gets to finish starting up 
and sets up logging.


Not logging errors on startup failures (in debug mode) is a problem that 
causes a lot of consternation. I recall hearing once why it is that way, 
but don't quite recall. I'm sure I could search the archives and find out.


--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] database connections from external method

2005-10-19 Thread J Cameron Cooper

Vangelis Mihalopoulos wrote:


Tino Wildenhain wrote:


The threading is handled by the ZDA, so you can use query() or what
the method actually is.



I couldn't find a method like that... any hints?


It is indeed the 'query' method, which you pass a string with SQL.

It comes from Zope/lib/python/Shared/DC/ZRDB/dbi_db.py, inherited 
through a long path.


You might also look at ExtZSQLMethod.

http://www.zope.org/Members/jccooper/extzsql

--jcc


--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] A Flash file in Zope262

2005-10-18 Thread J Cameron Cooper

GAYOT Philippe SZSIC35 - BOM wrote:

I want to show a Flash file in my home's page under ZopeCMF 262. Could 
anyone tell me the best way to do that ?


It is precisely no different from the way you would do it with any other 
web server, except that the Flash movie comes from a File rather than a 
file.


--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] __getitem__ and returning a PageTemplateFile instance

2005-10-18 Thread J Cameron Cooper

Anders Bruun Olsen wrote:

On Sun, Oct 16, 2005 at 06:50:09PM +0200, Dieter Maurer wrote:


I am trying to make a product where-in I want to be able to return a
page based on the url, think something like /product/username
which would return a page with the users details.
For this purpose I am using __getitem__, but when I return a
PageTemplateFile instance it just tells me it has encountered a problem
publishing the object.


I such a case, you look at the traceback (which you can find in
the error_log object in your Zope Root Folder (ZMI)). 



It just says No exceptions logged. So it does not log any errors in
error_log. 
The error message I am getting is:


Site Error

An error was encountered while publishing this resource.

Debugging Notice
Zope has encountered a problem publishing your object.

Cannot locate object at: http://localhost:8080/vitester/asonhe 




If it does not solve the problem directly, you include
the full error information (at least Error Type, Error Value
*AND* traceback) in your post.



If there had been a better error description I would of course have
included it, but the thing that has made this difficult to understand is
that I haven't been able to find any real error messages. I have enabled
debug-mode and am running Zope in the foreground, but it reports no
errors at all.


error_log is by default set to ignore three common types of exceptions. 
You should remove NotFound from the list if you're getting NotFound 
exceptions and want to see them.


--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] __getitem__ and returning a PageTemplateFile instance

2005-10-18 Thread J Cameron Cooper

Anders Bruun Olsen wrote:

On Tue, Oct 18, 2005 at 03:30:42PM -0500, J Cameron Cooper wrote:

error_log is by default set to ignore three common types of exceptions. 
You should remove NotFound from the list if you're getting NotFound 
exceptions and want to see them.



Ahhh.. Thanks, now I have a traceback, unfortunately it didn't make it any
more clear to me what the problem is.

Traceback (innermost last):
  Module ZPublisher.Publish, line 104, in publish
  Module ZPublisher.BaseRequest, line 355, in traverse
  Module ZPublisher.HTTPResponse, line 651, in debugError


In Zope 2.7, I see that line raising a debug error. Why it doesn't get 
through I don't know, but here's what it says::


 The object at %s has an empty or missing  \
 docstring. Objects must have a docstring to be  \
 published. % URL

That should help you, I think. All Zope objects that are to be published 
to the web must have a docstring.


--jcc

--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] Zope 2.7.8 or Zope 2.8.X

2005-10-13 Thread J Cameron Cooper

Dennis Allison wrote:
We have been running on Zope 2.7.6 with a few patches.  I am now planning 
to migrate to Zope 2.7.8 but am pondering the move to Zope 2.8.  We are in 
a production situation and cannot accept any downtime, so I am very 
concerned about stability and compatibility.


Can the list provide words of advice?


Try it on a test server first.

--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] selected in select lists

2005-10-12 Thread J Cameron Cooper

Garry Saddington wrote:


I have a variable called 'groupabbrev' in the REQUEST. I am trying to 
automatically select an option in a select list based on this variable.
I have tried this code and many others, and many googles but have not 
found anything that works. Can anyone see what I am doing wrong?



select name=groupabbrev
dtml-in getpastoralgroups
option value=dtml-var groupabbrev dtml-if 
expr='groupabbrev'==_['sequence-item'] selected/dtml-if dtml-var 
groupabbrev/option

/dtml-in
/select


Why have you put 'groupabbrev' in quotes? That makes it a string, and 
the condition will only be true when the current item is equal to 
groupabbrev.


Presumably you want the value of the variable named that, rather than a 
string of that name.


Also, watch the values of what 'getpastoralgroups' returns. The 
condition will never be true if they are not strings or converted into such.


--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] selected in select lists

2005-10-12 Thread J Cameron Cooper

Garry Saddington wrote:

J Cameron Cooper wrote:


Garry Saddington wrote:



I have a variable called 'groupabbrev' in the REQUEST. I am trying to 
automatically select an option in a select list based on this variable.
I have tried this code and many others, and many googles but have not 
found anything that works. Can anyone see what I am doing wrong?



select name=groupabbrev
dtml-in getpastoralgroups
option value=dtml-var groupabbrev dtml-if 
expr='groupabbrev'==_['sequence-item'] selected/dtml-if 
dtml-var groupabbrev/option

/dtml-in
/select




Why have you put 'groupabbrev' in quotes? 



I am fishing in the dark

That makes it a string, and the condition will only be true when the 
current item is equal to groupabbrev.


Presumably you want the value of the variable named that, rather than 
a string of that name.


Also, watch the values of what 'getpastoralgroups' returns. The 
condition will never be true if they are not strings or converted into 
such.


--jcc



Now I have tried both of the following with no result:
dtml-if expr=groupabbrev==_.str(_['sequence-item'])

dtml-if expr=groupabbrev==_['sequence-item']

Are there any other ways I could try?


What does groupabbrev look like? What does _['sequence-item'] look like? 
Can they ever be equal?


--jcc

--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] selected in select lists

2005-10-12 Thread J Cameron Cooper

Garry Saddington wrote:

Nicolas Gouzy wrote:


I think this code works :

select name=groupabbrev
dtml-in getpastoralgroups
option value=dtml-var expr=_['sequence-item'] dtml-if
expr=groupabbrev==_['sequence-item'] selected/dtml-if dtml-var
expr=_['sequence-item']/option
/dtml-in
/select

--
Nicolas Gouzy
[EMAIL PROTECTED]


 


This producing the following result, is this what it should do?
select name=groupabbrev
  option value=Shared.DC.ZRDB.Results.r object at 
0x43aa7c0cShared.DC.ZRDB.Results.r object at 0x43aa7c0c/option
  option value=Shared.DC.ZRDB.Results.r object at 
0x43f95824Shared.DC.ZRDB.Results.r object at 0x43f95824/option
  option value=Shared.DC.ZRDB.Results.r object at 
0x43aa7c0cShared.DC.ZRDB.Results.r object at 0x43aa7c0c/option
  option value=Shared.DC.ZRDB.Results.r object at 
0x43f95824Shared.DC.ZRDB.Results.r object at 0x43f95824/option

/select


Like I said: be careful about what comes out of getpastoralgroups.

These are Result objects, not strings. Like any result objects, they 
store data in attributes with the same name as the row that came out of 
the SQL results.


You must use a row in your comparison: a Result object can never be 
equal to a string.


--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] Re: DTML-tree Custom sort

2005-10-05 Thread J Cameron Cooper

Chris Beaven wrote:

It's really more a cool way to do lists than if statements  :)


It's technically list comprehension. Sort of a one-line list transform 
tool.


I recommend reading through some of Dive Into Python 
(http://diveintopython.org/) for lots more cool hands-on tips on Python 
programming. Chapter 3 for a good overview of the uses of Python's 
different data types.


Good advice.

--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] emergency access problems

2005-09-29 Thread J Cameron Cooper

michael nt milne wrote:

Hi
 
I appear to be having difficulty logging into the ZMI using the password 
created on install. I did change some settings to my root login using 
the Samplex member product etc but didn't change the password, login etc.
 
Anyway I've followed all the instructions in security.txt, telnetting in 
as the user that made the zopeinstance and running
 
  python zpasswd.py access
 
using SHA-1 and then entering nothing for domains ( I presumed that this 
would give access for all domains etc)
 
I then get an access denied message on running this and the access file 
is not created.
 
Any help would be appreciated. I guess I can always create a new zope 
instance and delete the old one?


You must make sure the access file is in the right place (an instance 
home, I believe) and you have to restart for it to take effect.


--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] Zope scalability / efficiency question

2005-09-20 Thread J Cameron Cooper

mark hellewell wrote:

Hi everyone, I've got a question I'd really appreciate some input on.

If I'm running perhaps a dozen Zope sites, experiencing anywhere
between several hits per second to a lot less, would it potentially
be more efficient (decreased latency etc.) to run each site as its own
Zope instance or have one Zope instance running muliple (CMF based)
sites.

I haven't even thought about adding ZEO into the mix yet.

The basic aim of the exercise is to find out how many usable
zope instances / sites I could get onto a typical mid-range 
modern server.


I know it's a bit of a how long are your pieces of string sort
of question, but any help you could offer would be gratefully
accepted! If anyway has any experience of this sort of setup
and can offer a little insight it might reduce the amount of
testing I have to do myself.


I don't think you'll see any improvement unless you have a 
multi-processor machine. In such a case, running X processes (where C is 
the number of cores) will fully load the machine, since Python threads 
won't skip processors.


On a single-core machine, multiple instances probably will just increase 
your overhead, especially in memory. But I could be wrong: there's so 
many variables the best way to know is to test. (Caches and usage 
patters, for instance, can make a big difference.)


If you do have several sites, you could be running into cache eviction 
issues since there are a lot of objects that need to be accessed. Check 
your cache fullness and watch your ZODB usage chart for excessive loads.


--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] How to show field names from sql query?

2005-09-20 Thread J Cameron Cooper

Thomas Apostolou wrote:

Hello all,
i use the following to get to show the results from an
sql query.
What are the expresions to show the field names?

table
  dtml-in expr=TestODBCEM(sysDSN=sysDSN, usr=usr,
mypass=mypass, sSQL=sSQL)
dtml-if sequence-even
  tr bgcolor=lightgreen
dtml-else
  tr
/dtml-if
dtml-in sequence-item
  tddtml-var sequence-item/td
/dtml-in
/tr
  /dtml-in

/table


You can ask the Results object 'names()' to get the names of the columns 
of your results. Note you need to ask the results list, not an 
individual result, so you'll need to define TestODBCEM(sysDSN=sysDSN, 
usr=usr, mypass=mypass, sSQL=sSQL) as something so as to ask it for 
names and loop over it later.


--jcc

--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] Same product in multiple instances automatically?

2005-09-09 Thread J Cameron Cooper

Kirk Strauser wrote:

On Friday 09 September 2005 10:25, Paul Winkler wrote:


To be honest, I'd expect something a little different, namely that each
instance would automatically pull in all the products in the site
installation (like [1] and [2] above), but that doesn't seem to be the
case.  Is that a configuration issue, by design, or by accident?


It's a configuration issue.  Check out the products directive
in zope.conf.



The one that says:

The master Products directory exists in Zope's software home, and
 cannot be removed from the products path (and should not be added to it
 here).

?  That seemed to me that I shouldn't be adding /usr/local/www/Zope/Products 
to the search path, although I'm unsure of the reasons.


I don't know why, either. That simply says that there is a default 
Products directory ($SOFTWARE_HOME/lib/python/Products), you can't get 
rid of it, and you shouldn't try to configure it here. The more 
interesting part is::


   Name of a directory that contains additional Product packages.  This
   directive may be used as many times as needed to add additional
   collections of products.  Each directory identified will be
   added to the __path__ of the Products package.

If you want your instances to use Products from some other directory, 
name it here.


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

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


Re: [Zope] Same product in multiple instances automatically?

2005-09-09 Thread J Cameron Cooper

Kirk Strauser wrote:

On Friday 09 September 2005 13:56, J Cameron Cooper wrote:


I don't know why, either. That simply says that there is a default
Products directory ($SOFTWARE_HOME/lib/python/Products), you can't get
rid of it, and you shouldn't try to configure it here.


The problem I'm having, though, is that those products don't seem to be 
present in instances by default, which is the opposite of what I'd expect.  
For example, I'd think that ZPsycopgDA would be available inside each 
instance since it's present in $ZOPE/Products.


Anything in $SOFTWARE_HOME/lib/python/Products is available in any 
instances that use that SOFTWARE_HOME. You can see this quite easily by 
looking at the /Control_Panel/Products of an instance with nothing in 
its $INSTANCE_HOME/Products.


I'm not sure what you mean by $ZOPE/Products.


If you want your instances to use Products from some other directory,
name it here.


Yep.  I'm wondering if I should create a $ZOPE/CommonProducts directory and 
add products $ZOPE/CommonProducts to every instance's zope.conf.


You can. I typically do the symlink thing, as I can just copy them from 
an existing instance with a similar or identical setup.


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

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


Re: [Zope] Same product in multiple instances automatically?

2005-09-09 Thread J Cameron Cooper

Kirk Strauser wrote:

On Friday 09 September 2005 15:37, J Cameron Cooper wrote:



Anything in $SOFTWARE_HOME/lib/python/Products is available in any
instances that use that SOFTWARE_HOME. You can see this quite easily by
looking at the /Control_Panel/Products of an instance with nothing in
its $INSTANCE_HOME/Products.

I'm not sure what you mean by $ZOPE/Products.



OH!  I see what you mean.  $ZOPE is defined in $INSTANCE/etc/zope.conf.  In 
my case, it's set to /usr/local/www/Zope, and there's a Products directory 
inside it.  FreeBSD installs new products to that directory.  I hadn't 
noticed that there was also a /usr/local/www/Zope/lib/python/Products 
directory with different contents.


Problem solved, although I'm not sure why /usr/local/www/Zope/Products 
exists in the first place; maybe it was meant to be a symlink 
to ./lib/python/Products?  Anyway, I think I can figure it out from here.  
Thanks!


In the beginning, there was only one Products directory; this was in 
lib/python/ along with the rest of the software defining Zope. If you 
wanted to have, say, two or more running distinct instances of Zope you 
would have to copy the whole thing. Plus, with third-party products 
co-mingling with default products, upgrading became difficult.


Thus was created the instance/software distinction. Everything needed to 
run Zope goes into the SOFTWARE_HOME; everything that defines a specific 
distinct instance goes into INSTANCE_HOME (3rd party Products, Data.fs, 
config files, logs, etc). You can thus manage (move, upgrade, etc) 
instances and software separately, and don't have to copy the whole 
thing to run many instances. (On my dev box, I may have 4-5 running at 
one time, and maybe 20 total!)


This should explain why there are two such directories, and how they 
should be used. Short version: do not touch the SOFTWARE_HOME after it 
has been installed. In fact, it might be a good idea to remove all write 
permissions from that directory. You can co-mingle, of course, but be 
aware of what advantages you are losing.


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

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


Re: [Zope] Zope scalabilty and problems

2005-08-31 Thread J Cameron Cooper

Kennamore, Matthew G [NTK] wrote:
Here is our situation, we originally launched zope with a small user 
base in mind and like most IT implementations it got away from us 
quickly and we have over 1000 users now.  We are experiencing huge 
slowdowns and lots of complaints of performance.


Let me outline our system:

I have a load balancer that round robins incoming request to 3 zeo servers

I have 1 zope server on the back en that severs the data, this is a 
large single processor machine with 4 gigs of ram


Each zeo server is 2 gigs of ram, single processor 3.2 gighz

The throughput doesn’t appear to be the problem as ram/processors are.

Short term I plan to change all zeo’s to 4 gigs ram and add 3 additional 
servers.



The Technologies we are using are Zope, Zeo, plone and so forth.  Why 
are we having these large issues?  I see sites with hundreds of 
thousands of users and they don’t seem to have these issues?  We plan to 
recode our site to get away from the Data.fs as soon as we can but that 
is a ways off yet.  What am I doing wrong can anyone help?


You will need to find out where the slow bits are. There are various 
profiling tools for use in Zope. PTProfiler, CallProfiler, etc. Also 
examine your ZODB cache graphs and settings. These can tell you where 
your bottlenecks are.


There are lots of ways to improve performance just administratively. You 
can improve various zope.conf settings, and set up caching (either RAM 
or HTTP Accel.) in Plone. You can also put a caching proxy server (like 
Squid) in front of your Zopes.


Also, Plone 2.1 is significantly faster.

--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] SQL Problem

2005-08-25 Thread J Cameron Cooper

Philip Beardmore wrote:

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

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

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


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


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

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


Re: [Zope] max 2 levels of indirection?

2005-08-22 Thread J Cameron Cooper

Sean Dunn wrote:
I’m running Zope 2.0.7, and I’m having a problem.. Consider me a newbie, 
as I’ve only been using Zope for a few weeks.


After boiling the problem down to a test case, it seemed that I couldn’t 
have a DTML method call a DTML method which then calls a Python script. 
But then I realized it was a more general problem of max number levels 
of indirection.. So I can’t have a DTML-DTML-DTML or 
DTML-DTML-PythonScript. Is this a bug? When I try this, I get a Name 
Error, which says that the name of the 3^rd level object is not defined.


Here’s an example:

DTML Method TestA:

dtml-var expr=”TestB()”

DTML Method TestB:

dtml-var expr=”TestC()”

DTML Method TestC:

Test C has run.

If I view TestA, I get the NameError that TestC doesn’t exist. If I view 
TestB, I get the output “Test C has run”. All objects are in the same 
folder.


Is there some namespace weirdness that I don’t understand?


When you call DTML methods directly, they expect to be passed certain 
parameters, including the namespace. When you simply use the names, this 
is done implicitly. When calling explicitly, you can lose the namespace 
if you don't follow the proper convention. I think you'll find that it 
works if you try::


 DTML Method TestA:

 dtml-var TestB

 DTML Method TestB:

 dtml-var TestC

 DTML Method TestC:

 Test C has run.

For calling DTML explicitly, it usually looks like::

 dtml-var expr=”TestC(None, _)”

See http://www.plope.com/Books/2_7Edition/AppendixE.stx for why.

Also:
http://mail.zope.org/pipermail/zope-db/2003-March/001554.html

This is one of the good reasons to avoid DTML, by the way.

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

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


Re: [Zope] Re: dtml-var variable from REQUEST not shown in input tag if it has spaces??

2005-08-12 Thread J Cameron Cooper

Josef Meile wrote:

Hi Thomas,


When i just use it as dtml-var sSQL everything is
ok.
When i use it like : input type=text
value=dtml-var sSQL, i get everything until the
first space. For example from select * from mytable
i get select.


I'm not sure, but don't you need to enclose it with double quotation
marks? Something like this:

input type=text value=dtml-var sSQL

You can also try:

input type=text value=dtml-sSQL;


I suspect this to be the right answer. The way to diagnose this would be 
to have looked at the page source itself. You would have seen something 
like::


 input type=text value=select * from mytable

From this it seems obvious why only 'select' was showing up in the 
rendered output.


--jcc

--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] Re: localhost:8080 not found on windows

2005-08-09 Thread J Cameron Cooper

michael nt milne wrote:

Ok, thanks. Yes, Apache would be much better to route traffic through.
And also it looks like a complete pain to try and route traffic
through IIS.


That's my understanding. You can either look up the ASP404 hack or use 
something like http://www.enfoldsystems.com/Products/EEP



Is Apache for windows good? I only have experience of it
on UNIX


I last ran Apache on Windows back when it was 1.something. It still had 
a be careful on Windows notice, in fact. I didn't have any problems, 
but then I wasn't using it very hard. I would assume it's gotten better.



Since I am not expecting very high traffic for my site at first I am
going to use the Zope server at first. My head is hurting too much
just now!


Apache is useful for keeping maliciously formed requests and other junk 
away from Zope. ZServer is capable, but Apache is much more serious. 
Running Zope exposed to the public network is not the best idea in the 
world, though you can get away with it.



By the way do you have any experience of altering the zope database or
adding fields to the registration process on Plone etc? Seems a wee
bit tricky and a client wants extra fields etc.


See CMFMember. Also, ther's a howto on plone.org about this. There's 
about four places you have to touch, but it's not such a big deal.


--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] rendering the contents of ..

2005-08-03 Thread J Cameron Cooper

David Bear wrote:

On 8/1/05, J Cameron Cooper [EMAIL PROTECTED] wrote:


David Bear wrote:


I am looking at a couple way of producing a qotd solution.

one way is to put quotes in a folder. Then use objectvalues on the
folder  and randomly select one of the items. I get get the objectid.
but I don't know what I use to get the 'content' of the object.. what
is the method to get the 'rendered' and unrendered content of an
object.

In this case I'm using objects of type file (setting content type to
text/plain) (ofcourse the content is plain text)

I may find the using a zpt, html, or stx object will work better. I'm
hoping there is a method to get either a rendered view of the file,
(if zope knows how to render it) or unrendered, and I'll worry about
rendering it elsewhere.


The contents of a File object can be gotten at simply by calling it. You



sorry to be dense here. Its been a long time since I read the zope
book. I have the following code:
=
from Products.PythonScripts.standard import html_quote
import random
request = container.REQUEST
RESPONSE =  request.RESPONSE
# Return a string identifying this script.
q = container.quotes.objectIds()
print random.choice(q)()
return printed
=

But this returns an TypeError, str is not callable. How do I get this
code to return a random object from the quotes container?


Of course it does. What does 'objectIds' return? Answer: a list of ids 
(strings) and not objects. If you want objects, you must ask a different 
way, as another message provides.


Also, there's not particular reason to use the 'print' facility. You may 
simply say::


  return random.choice(q)()

and get the same effect.

--jcc


can also get at the underlying data with the 'data' attribute, which is
useful if the contents are large (since it provides a 'Pdata' object
rather than a string.) This is just as it says in
http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/AppendixB.stx

Other object types, like those that have to do rendering, you can just
call for the rendered content. Methods 'document_src' or 'read' will
usually work for the source.

   --jcc
--
Building Websites with Plone
http://plonebook.packtpub.com








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

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


Re: [Zope] rendering the contents of ..

2005-08-01 Thread J Cameron Cooper

David Bear wrote:

I am looking at a couple way of producing a qotd solution.

one way is to put quotes in a folder. Then use objectvalues on the
folder  and randomly select one of the items. I get get the objectid.
but I don't know what I use to get the 'content' of the object.. what
is the method to get the 'rendered' and unrendered content of an
object.

In this case I'm using objects of type file (setting content type to
text/plain) (ofcourse the content is plain text)

I may find the using a zpt, html, or stx object will work better. I'm
hoping there is a method to get either a rendered view of the file,
(if zope knows how to render it) or unrendered, and I'll worry about
rendering it elsewhere.


The contents of a File object can be gotten at simply by calling it. You 
can also get at the underlying data with the 'data' attribute, which is 
useful if the contents are large (since it provides a 'Pdata' object 
rather than a string.) This is just as it says in 
http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/AppendixB.stx


Other object types, like those that have to do rendering, you can just 
call for the rendered content. Methods 'document_src' or 'read' will 
usually work for the source.


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

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


Re: [Zope] What Maximum age of a cache entry (seconds) means in RAM Cache Manager?

2005-07-30 Thread J Cameron Cooper

Litao Wei wrote:


I have read the zope book and zope online help about RAM Cache
Manager. But all of them didn't say anything about the parameter What
Maximum age of a cache entry (seconds) mean.
It looks that this parameter like Cleanup interval (seconds), which
zope book explained as The lifetime of cached results.. But what
this parameter mean? Would somebody give me an explaination?


It means exactly as it seems to mean.

Maximum age:

No cache entry older than n seconds, where n is the value you supply for
that setting, will be used.

Cleanup interval:

Appx every n seconds, sweep the cache and remove entries that are
expired, as in the above parameter.

You would not want to do this too often (for performance reasons) nor
too little (lest the cache become very large).

--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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

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


Re: [Zope] product organization

2005-07-27 Thread J Cameron Cooper

Nicholas Wieland wrote:


As usual, my question is rather simple :)
I'd like to know what are the best practices for product organization 
- for example I have _tons_ of queries to sqlserver, and my main 
class is becoming less manageble every time I look at it :/
I like the way SQL integrates in Zope, what I don't like is having a 
giant __init__ and a lot of _sqlSomething at the end of the class.
 
Can I associate queries to something else than a _variable ? 
Something like a dictionary or a class ? Can I move SQL calls outside 
the initializer ? I'd prefer to have a class for data access and 
another one to glue all the parts together, maybe I'm plain wrong but 
I think that my product would be a lot cleaner.
What are the best practices for FS based products ? 




If you're writing SQL queries attached to a Product and using them in 
said Product, you should look at ExtZSQL:


http://www.zope.org/Members/jccooper/extzsql

It was made for precisely this problem.

   --jcc


--
Building Websites with Plone
http://plonebook.packtpub.com/

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-PAS] auth fallback with cookies

2005-07-26 Thread J Cameron Cooper
Say I have a user in a root acl_users folder (call it 'admin'). I also 
have a PAS user folder in a sub-object of the root. This PAS is 
configured to do cookie auth, and users will typically login using a form.


Now, if I try to log in as 'admin' in that form, it doesn't work. I 
think this is why:


 - credentials are supplied via a form to the PAS cookie auth plugin

 - there is no such user, so it fails

 - 'validate' returns None, so Zope goes to the next user folder (which 
the basic in the root where 'admin' lives)


 - that one tries to validate but gets nothing: it looks for HTTP basic 
credentials, but finds nothing, since login is form based


Does this sound about right? Anybody have a strategy to get around this?

--jcc
--
Enfold Systems, LLC
http://www.enfoldsystems.com

___
Zope-PAS mailing list
Zope-PAS@zope.org
http://mail.zope.org/mailman/listinfo/zope-pas


Re: [Zope] getting atachments with python - pop3

2005-07-25 Thread J Cameron Cooper

Jonathan Salazar Santos wrote:

Hi, im making a email client in python for zope, but a im stopped
because i cant find the way to get the attacments with python, do you
have a idea how can i do this?, i have studied the email package
already but is a little confused.


A Python-specific list might be more on-topic.'

But look at the python modules:

http://python.org/doc/lib/module-email.html
http://python.org/doc/lib/module-mimetools.html

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

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


Re: [Zope-dev] Re: Listing a groups users via Python and portal_groups

2005-07-22 Thread J Cameron Cooper

Hitesh Shetty wrote:
Im trying to implement a file system 
in the process i came accross Zope and ZODB

however i cant figure out where to start
since its important to study ZODB's architecture
regards


http://www.zope.org/Documentation/Articles

Specifically

http://www.zope.org/Documentation/Articles/ZODB1
http://www.zope.org/Documentation/Articles/ZODB2

Also

http://www.zope.org/Wikis/ZODB/FrontPage
http://www.zope.org/Members/adytumsolutions/HowToLoveZODB_PartI

And, of course,

http://www.zope.org/Documentation/Books/ZopeBook/

None of this was difficult to find.

--jcc

___
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] Listing a groups users via Python and portal_groups

2005-07-21 Thread J Cameron Cooper

Takahashi, Michael wrote:

I’m trying to work on a function call using Python that will list the 
users of any specified group using the function portal_groups.


I’ve been able to successfully do this the opposite way by getting the 
users groups via portal_membership:


portal.portal_membership.getAuthenticatedMember().getGroups()

Which will return all groups this user is associated with.

So I’ve been testing using portal_groups with function calls similar to 
this:


portal.portal_groups.getGroupById(staff).getUsers()

Where “staff” is the name of the group. This almost does what I need, 
but not quite close enough because it lists all groups and all users.  
Any suggestions or help is greatly appreciated!


It acquires 'getUsers' from somewhere, I guess.

Group objects have 'getGroupMemberIds' and 'getGroupMembers' methods.
You can see this in Products.GroupUserFolder.GroupDataTool.GroupData.
the Products.GroupUserFolder.interfaces.portal_groupdata is a bit
cleaner, but seems a little behind the times, as it's missing
'getGroupMemberIds'.

Note that this isn't a good topic for zope-dev, but more for plone-users.

--jcc

___
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] Listing a groups users via Python and portal_groups

2005-07-21 Thread J Cameron Cooper

Takahashi, Michael wrote:

Thanks for the help, I actually figured it out.  It turned out that
portal.portal_groups.getGroupById(staff).getGroupUsers() was the
solution.  However, the getGroupUsers() function returns a list of
users, but not as strings.  So I had to convert the entire call with
str() in order to run a comparison.

So in the end this is how I achieved what I needed:

portal.portal_membership.getAuthenticatedMember().getId() not in \
str(portal.portal_groups.getGroupById(staff).getGroupUsers())


The 'getGroupUsers' is not a good idea in a CMF environment. You should 
use the methods from the group tools. Like the ones I mentioned by name. 
One of them even does exactly what you want::


  context.portal_groups.getGroupById('group1').getGroupMemberIds()

--jcc


-Original Message-
From: J Cameron Cooper [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 21, 2005 12:36 PM

To: Takahashi, Michael
Cc: zope-dev@zope.org
Subject: Re: [Zope-dev] Listing a groups users via Python and
portal_groups

Takahashi, Michael wrote:


I'm trying to work on a function call using Python that will list the 
users of any specified group using the function portal_groups.


I've been able to successfully do this the opposite way by getting the




users groups via portal_membership:

portal.portal_membership.getAuthenticatedMember().getGroups()

Which will return all groups this user is associated with.

So I've been testing using portal_groups with function calls similar


to 


this:

portal.portal_groups.getGroupById(staff).getUsers()

Where staff is the name of the group. This almost does what I need, 
but not quite close enough because it lists all groups and all users.




Any suggestions or help is greatly appreciated!



It acquires 'getUsers' from somewhere, I guess.

Group objects have 'getGroupMemberIds' and 'getGroupMembers' methods.
You can see this in Products.GroupUserFolder.GroupDataTool.GroupData.
the Products.GroupUserFolder.interfaces.portal_groupdata is a bit
cleaner, but seems a little behind the times, as it's missing
'getGroupMemberIds'.

Note that this isn't a good topic for zope-dev, but more for
plone-users.

--jcc






___
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] Python formatting question

2005-07-21 Thread J Cameron Cooper

[EMAIL PROTECTED] wrote:

In a Python script, how can I break up a SQL statement over more than 
one line?  For example, to transform


#generate the sql statement
sql=DELETE FROM tblUsers WHERE user_name LIKE '%'

to:

#generate the sql statement
sql=DELETE FROM tblUsersWHERE user_name LIKE '%'

...does not work. Is there a way to break lines?

Any example would be appreciated.



Python allows you to you triple-quotes to include line breaks in the
string::

 sql=DELETE FROM tblUsers
WHERE user_name LIKE '%'

Take a look at the python.org tutorial or diveintopython.org.

--jcc


___
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] ZPyIRC and Zope 2.7

2005-07-21 Thread J Cameron Cooper

David wrote:

Hi

I installed ZPyIRC version 0.1.3 in Zope 2.7.5 and I get Zope  Template 
Errors on two of the frames when trying to start a chat  client. I don't 
know ZTP very well. (Python is 2.3.5)


I was hoping that maybe somebody has fixed the templates for 2.7.

Any help very welcome!

DR

Here a traceback from cwindowlist:

Traceback (innermost last):

Module ZPublisher.Publish, line 101, in publish
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 39, in call_object
Module Shared.DC.Scripts.Bindings, line 306, in __call__
Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec
Module Products.PageTemplates.PageTemplateFile, line 106, in _exec
Module Products.PageTemplates.PageTemplate, line 88, in pt_render
PageTemplateFile at /site/chat/stratis/ 
4d9d10fad2a83777ee81bbbae6be3f44/cwindowlist

Warning: Compilation failed
Warning: TAL.HTMLTALParser.NestingError: Open tags html, head,  
script do not match close tag /div, at line 262, column 50

PTRuntimeError: Page Template has errors.

Here a traceback from cuserlist:

Traceback (innermost last):

Module ZPublisher.Publish, line 101, in publish
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 39, in call_object
Module Shared.DC.Scripts.Bindings, line 306, in __call__
Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec
Module Products.PageTemplates.PageTemplateFile, line 106, in _exec
Module Products.PageTemplates.PageTemplate, line 88, in pt_render
PageTemplateFile at /site/chat/stratis/ 
4d9d10fad2a83777ee81bbbae6be3f44/cuserlist

Warning: Compilation failed
Warning: TAL.HTMLTALParser.NestingError: Open tags html, head,  
script do not match close tag /td, at line 32, column 79

PTRuntimeError: Page Template has errors.


The HTML is imbalanced. HTMLTidy may help you, or maybe an editor, but 
you can always count the tags by hand.


--jcc

___
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] Passing a variable to RESPONSE.redirect

2005-07-15 Thread J Cameron Cooper

Asad Habib wrote:

Is it possible to pass a variable to RESPONSE.redirect or does the page
name have to be a literal string? I was unable to pass in a variable via
the REQUEST object (i.e. REQUEST.get('pageName')) or the SESSION attribute
of the REQUEST object (i.e. REQUEST.SESSION.get('pageName')). Any help
would be appreciated. Thanks.


How do you mean unable? That's not a very good problem description.

RESPONSE.redirect is simply a Python method, and it will take any string 
you can manage, no matter where it comes from. In fact, I think it would 
be very difficult to do otherwise.


You must, of course, pass the value of a variable, and not the variable 
itself. None of the following pose any problem::


 REQUEST.RESPONSE.redirect(http://plone.org;)

 url = http://plone.org;
 REQUEST.RESPONSE.redirect(url)

 def redir():
   return http://plone.org;
 REQUEST.RESPONSE.redirect(redir())

 urls = {}
 urls['plone'] = http://plone.org;
 REQUEST.RESPONSE.redirect(urls['plone'])

 REQUEST.RESPONSE.redirect(urls.get('plone', /))

In fact, they should all work identically.

   --jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] How to upload a file and save it in a physical path

2005-07-15 Thread J Cameron Cooper

Remy Pinsonnault wrote:

Maybe it is a basic question but how can I upload a file and save it
anywhere on the server's hard drive? I know how to upload a file to
zope's database but not how to save it locally...

Anyone can help please?


There are several products to do this: LocalFS, ExtFile/ExtImage, 
ExternalFile, and more.


There are other methods (like writing an External Method and using 
Python's file methods) as well.


All of this has been discussed on this list and elsewhere, and are 
otherwise described on the web.


--jcc

--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] Zope update

2005-07-13 Thread J Cameron Cooper

Josef Burger wrote:

Hi,

I want to update from Zope 2.7.4 to Zope 2.7.6

What is the easiest way?

Unfortunately there is no description of how an update of Zope is done. I'm 
running Plone on it. I tried to newly install Zope 2.7.6 and then copied the 
backed-up Data.fs file and the content of the Products folder. It didn't work 
very well. There should be no version conflicts with Plone as I checked on the 
Plone web site.


Didn't work very well is not a good description of a problem.

You should be able to replace the existing Zope SOFTWARE_HOME with a new 
version. (I don't know if over-writing is safe; I wouldn't count on it.) 
This may be easiest.


You should also be able to install Zope in a different location, create 
a new instance, and copy over the config files, products, and Data.fs of 
your old instance.


(All this is because the instance scripts point to a specific 
SOFTWARE_HOME. You could also change that.)


--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] Re: [ZPT] Recursive structures

2005-07-01 Thread J Cameron Cooper

Nikko Wolf wrote:

Ian Bicking wrote:

I'm surprised this has never come up for me before, but now I want to 
render a recursive data structure and I'm at a loss how I might do 
that in ZPT.  Or, what the best workaround would be.  E.g.:


['a', 'b', ['c', ['d', 'e']]]

Becomes:

ul
 lia/li
 lib/li
 ul
  lic/li
  ul
   lid/li
   lie/li
  /ul
 /ul
/ul


I've made recursive macros before. It's not so different from other 
recursion techniques. Here's one to render a site tree::


 html
   head
 title tal:content=template/titleThe title/title
   /head
   body
 Site structure:

   tal:contain define=location nocall:here
div metal:use-macro=template/macros/list /
   /tal:contain

   /body
 /html

 tal:hidemacro replace=nothing
 metal:recurse define-macro=list
   ul
 li tal:repeat=elt location/objectValues
   span tal:content=elt/getIdobjectId/span
   metal:block tal:condition=elt/isPrincipiaFolderish
tal:define=location nocall:elt
   div metal:use-macro=template/macros/list /
   /metal:recurse
 /li
   /ul
 /metal:recurse
 /tal:hidemacro

It will go from 'context', of course, unless you were to change the 
definition of 'location' in the page.


You can imagine how this would work with a nested list: you just have to 
have ways of checking containership and getting contents.


--jcc

--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] Sequencing pages

2005-06-29 Thread J Cameron Cooper

John Poltorak wrote:

On Tue, Jun 28, 2005 at 03:45:01PM -0500, J Cameron Cooper wrote:


John Poltorak wrote:

If I create individual pages for a website as sub folders of a sites main 
folder, how do I control the sequence of pages if I automatically generate 
a set of links to all the folders? I presume that under normal 
circumstances that sequence would be in alphabetical order of object ID.


The standard folder lists its contents in unspecified order. In 
practice, it's in order of creation (I think.)



Creation date sequence seems to explain the order I'm seeing.

You can get ordered folders, which support changing the order. In fact, 
one ships with Zope in recent versions. Look for Folder (Ordered).
 
I've often wondered what 'Folder (Ordered)' was for. 

Is there an example of its usage I can take a look at anywhere? 


Make one on your box and look at it. It's not like you can't just delete it.

--jcc

--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] TAL and Javascript

2005-06-29 Thread J Cameron Cooper

Rob Boyd wrote:

I'm stuck this, and would appreciate help or pointers.

I have a form with 2 selection drop-downs. I want the user's choice of
select 1 to drive the options displayed in select 2. When the user
makes a selection in select 1, onChange calls a Javascript function
that should write select 2 options based on the result of a call to a
Python script, passing the select 1 choice as an argument to the Python
script.

But: I cannot get the Javascript var into the namespace that the TALES
expression knows about.

Example:

script
function makeDropDown() {
  var widget = document.getElementById('select1');
  var choice = widget.options[widget.selectedIndex].value;
  var data = [result of calling Python script 'foo(arg)' with
arg=choice]


This is impossible, at least in a single request. You are trying to mix 
server-side and client-side actions.


You would have to make a new request on the server with the contents of 
'choice' in order to get it processed. This can be done with XML-RPC or 
some other options; look up 'AJAX' to get a feel for this.


Alternately, if you have a known list of values for 'choice' you could 
generate all the 'data' values for each 'choice' value, encode them in 
the page's javascript, and look them up client-side.


--jcc

--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] TAL and Javascript

2005-06-29 Thread J Cameron Cooper

Rob Boyd wrote:

Thanks to all the responders. It gave me some ideas, but alas no luck.

To clarify, I am not trying to do everything in one request. Request
one generates the page, a user event (selecting an option from a form)
fires another request via javascript.


I do not see it creating another request. I see a DOM event. DOM events 
do not touch the server.



like:
script tal:content=python:'function getFormats() {
var widget = document.getElementById('orgs');
var chosen_org = widget.options[widget.selectedIndex].value;
var formats = %s;
// build selection 2 options from formats
' % here.getDataFormats(chosen_org) /

And then a user event (onChange) calls getFormats.

Even with generating the script with a Python script or DTML, the
problem remains (for me at least) to get a value from the DOM passed as
an argument to a Python script that queries my database.


Again, as I understand you, this is impossible.

Zope has no access to the DOM. Only to request parameters. This simply 
cannot work. ZPT can only insert values during page rendering, and the 
value for 'chosen_org' is decided after the page is rendered and in a 
browser. Unless you can invent a special time-traveling Javascript, this 
cannot work.


What would work is::

 script tal:content=python:'function getFormats() {
 var widget = document.getElementById('orgs');
 var chosen_org = widget.options[widget.selectedIndex].value;
 var formats = xmlrpcserver.getDataFormats(chosen_org);' /

This would actually create another request to Zope, running a script 
with you're dynamically generated value. Note: I don't know how xml-rpc 
is done in JavaScript, so I just made something up. Presumably 
'xmlrpcserver' is a handle on your Zope server. Also note that every 
time someone fires off this method, it's a request to the server.


(Also note: it doesn't have to be XML-RPC, just some way of asking the 
server. There are various methods used for this.)


You might also make the widget that you chose from be part of a form, 
and when a value is chosen, the form is submitted. This will get the 
'chosen_org' in a request, and your template can then render your second 
select list with the values from::


  'here.getDataFormats(request.chosen_org)'

This is the common 'old-school' way of doing this.

--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


Re: [Zope] Tweaking Zope DB- and connection parameters

2005-06-28 Thread J Cameron Cooper

Apache is set to MaxClients 50
Zope.conf has set zserver-threads 5 and 
zodb_db main

  cache-size 500
  pool-size 25
...
/zodb_db


I will note that a cache-size of 500 is ridiculously low. (Even though 
old versions of Zope shipped configured like this!)


It needs to be at least 5000. Frankly, 5 wouldn't be bad for a 
large, busy site.


To optimize your cache-size param, watch the ZODB read/write graph, and 
keep increasing the cache-size until (a) there's no more effect on reads 
or (b) you run into memory trouble.


Of course, the optimization will slip a little as site usage patterns 
change.


--jcc
--
Building Websites with Plone
http://plonebook.packtpub.com/

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 )


  1   2   >