Re: [Zope3-Users] Resource lookup by resource name

2009-10-17 Thread Shailesh Kumar
Hi Andreas,

I had a requirement where I needed to manage the resource directories
dynamically. So I developed some of following code. I guess this might
be of help.


Functions to work with browser resources at run time


#python imports
import logging

# zope imports
from zope.publisher.interfaces.browser import IDefaultBrowserLayer
from zope.interface import Interface
from zope.component.globalregistry import getGlobalSiteManager
from zope.app.publisher.browser.resourcemeta import (CheckerPublic,
DirectoryResourceFactory,
allowed_names, NamesChecker )


def registerResourceDirectory(name, resourcedir,
 layer=IDefaultBrowserLayer,
 permission='zope.Public'):

This function registers a resource directory with global registry

logging.info('Registering %s as %s' , resourcedir, name)
if permission == 'zope.Public':
permission = CheckerPublic
checker = NamesChecker(allowed_names + ('__getitem__', 'get'),
   permission)
factory = DirectoryResourceFactory(resourcedir, checker, name)
gsm = getGlobalSiteManager()
gsm.registerAdapter(factory, (layer,), Interface, name)
return True


def unregisterResourceDirectory(name,
 layer=IDefaultBrowserLayer):
logging.info('Removing %s' , name)
gsm = getGlobalSiteManager()
gsm.registerAdapter(None, (layer,), Interface, name)
return True



On Sat, Oct 17, 2009 at 12:41 PM, Andreas Jung li...@zopyx.com wrote:
 Assume I have a browser:resourceDirectory .../ configuration
 somewhere in my system. What is the API to lookup the the directory
 path for a configured resource 'name'?

 Andreas

 ___
 Zope3-users mailing list
 Zope3-users@zope.org
 https://mail.zope.org/mailman/listinfo/zope3-users


___
Zope3-users mailing list
Zope3-users@zope.org
https://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Multi platform dev environment

2009-06-02 Thread Shailesh Kumar
Hi Edward,
Philipp's book (2nd edition which I use) is written with Zope 3.3 in mind.
This was released few years ago. Since then, there has been quite a lot of
evolution in terms of how zope 3 is organized, how instances are created
etc.
- People now use zc.buildout commonly for creating instances and
distributing applications.
-  zopeproject is one recipe for zc.buildout way of doing things.
- People in the zope 3 development community are generally using
zc.buildout
- zopeproject based buildouts I believe can be distributed in its entirety.
They contain all the eggs necessary for your application.

I for myself, have continued to stick with the Zope 3.3.1 for this long as
Philipp's book covered it in quite detail and migrating to the newer ways of
organizing applications would require some work.

For more information about buildout, please visit http://www.buildout.org/


With regards,
- Shailesh




On Tue, Jun 2, 2009 at 6:12 AM, Edward Zwart ed.zw...@softserv.ca wrote:

 On Sat, May 30, 2009 at 12:00 AM, Shailesh Kumar shaile...@gmail.com
 wrote:
  Web component development with Zope 3 by Philipp von Weitershausen has
 been
  my best resource on zope 3 developement all these years. Find more about
  this book at : http://worldcookery.com/About

 Thanks Shailesh, I'm reading this book now actually!  I'm following
 along, and see where I was confused before.  I had inherited an
 instance created with zopeproject
 (http://pypi.python.org/pypi/zopeproject).  When I follow
 Weitershausen, I use mkzopeinstance, and get the following directory
 structure in the instance folder:

 bin/
 etc/
 lib/
 log/
 var/

 But running zopeproject produces:

 .installed.cfg
 apidoc.zcml
 bin/
 buildout.cfg
 debug.ini
 deploy.ini
 develop-eggs/
 log/
 parts/
 setup.py
 site.zcml
 src/
 var/
 zdaemon.conf
 zope.conf

 setup.py is a new config file, and site.zcml and zope.conf are in the
 root directory now instead of etc.

 Weitershausen deals with setup.py in the last chapter (of the 3rd
 edition anyway) when talking about distribution, and he mentions a
 layout similar to this.  But zopeproject seems to be the way to get
 started not the way to distribute... so I'm confused again.

 Can anyone explain the difference of these layouts/approaches to me?
 Much appreciated!

 e.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Multi platform dev environment

2009-05-30 Thread Shailesh Kumar
Hello,

I have been using Zope 3 primarily on Windows platforms for last 2.5 years.
This is what I do for the typical setup:

- Install Python 2.4.4
- Install Python for Windows extensions for Python 2.4
- Install Zope 3.3.1  (the binary installer)
- Go to C:\Python24\Scripts
- Use mkzopeinstance script to make a zope instance
- Checkout my application packages into the zope instance
- Run my application

Using the binary installers for everything works fine for me.

Apart from these, I use some more packages:
- ReportLab
- Python Imaging Library
- z3c.rml
- etc.


My SVN repository consists of my application package only. I don't check in
the zope instance to SVN. After checking out the application package in my
zope instance, I need to copy the application-configure.zcml into zope
instance's etc\package-include directory.


The zope 3.3.1 instances work perfectly as Windows services out of the box.


At times I experimented with virtualenv, and grok. But haven't been able to
stabilze their workflows on Windows so far.



Web component development with Zope 3 by Philipp von Weitershausen has been
my best resource on zope 3 developement all these years. Find more about
this book at : http://worldcookery.com/About

With regards,
- Shailesh





On Fri, May 29, 2009 at 10:47 PM, Edward Zwart ed.zw...@softserv.ca wrote:

 If I'm asking in the wrong place, please redirect me, thanks.

 I'm new to Zope 3 (coming from LAMP) and am having some trouble finding
 resources on how best to set up my dev environment.  I will be working in
 Windows and testing (and ultimately deploying) on Linux.
 I'm slightly confused about what to include in my svn repo.  ...everything
 from the server instance down?  That gives me the server config files, the
 db and my own code, but also a lot of stuff I don't really need, no?  Also,
 so far I've got 2 different directory structures on Windows and Linux.

 The Linux install was created with virtualenv, and the Windows one
 following the screencast Installing Zope 3.2 on windows from
 http://wiki.zope.org/zope3/Zope3Wiki#tutorials).

 So, obviously that's not okay, but I'm not really sure how to proceed.  I
 tried installing Zope with virtalenv in Cygwin, but ran into problems.  I
 just wanted to check in with some experts about the way I'm proceeding
 before continuing.

 Any advice or pointers to resources is greatly appreciated.

 Thanks

 e.

 ___
 Zope3-users mailing list
 Zope3-users@zope.org
 http://mail.zope.org/mailman/listinfo/zope3-users


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Wiki proposal

2009-05-30 Thread Shailesh Kumar
Hello,

I had seen a site new.zope.org coming up sometime back which was using
Sphinx for the documentation of Zope 3. Though there was never a public
announcement of the website on this mailing list. The approach seemed
promising.  It somehow supported integration of work from multiple
contributers from different websites. For example, z3c.form documentation
was integrated from Paul Cauldner's website.  Unfortunately today it seems
that the website has gone somewhere else and I don't know where it is.
Further digging shows that its now accessible at http://docs.zope.org/. I
think I missed out when this change happened.

There seems to be another thing coming up (which I noticed today).
http://docs.zope.org/zopetoolkit/ . Seems like zope 3 is going to be called
zope toolkit from 3.5 onwards. I have accidentally discovered it today. This
site is also developed in Sphinx.

I am not sure what is the process for contributing to these documentation
websites

Overall, to me it seems that Sphinx based documentation is better compared
to a Wiki based documentation. One can focus on writing documentation using
simple text editors.

The http://www.zope.org/ website talks about becoming a contributor, but
thats focused on becoming a developer. May be some more information can be
provided for becoming a documentation contributor.

- Shailesh


On Fri, May 29, 2009 at 6:25 PM, Massimiliano della Rovere 
massimiliano.dellarov...@gmail.com wrote:

 I was thinking about the idea of creating a wiki including classes,
 functions, examples and concepts about zope3, similar to the php
 documentation and more firendly than ++apidoc++

 If such a project were started, would you be interested in partecipating?
 ___
 Zope3-users mailing list
 Zope3-users@zope.org
 http://mail.zope.org/mailman/listinfo/zope3-users

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Search multiple fields with TextIndex

2009-02-13 Thread Shailesh Kumar
please have a look at AttributeIndex mixin.
http://apidoc.zope.org/++apidoc++/Book/indexcatalog/catalog/show.html

Having 3 different Attribute Indices might be a better idea than 3 different
Text Indices.


With regards,
- Shailesh


On Fri, Feb 13, 2009 at 10:33 PM, Massimiliano della Rovere 
massimiliano.dellarov...@gmail.com wrote:

 Suppose I have an object with the following interface:
 IArtFile
 author: TextLine...
 subject: Textline...
 location: TextLine...

 I setup 3 text indices and create 3 adapters implementing
 ISearchableText to extract each field.

 I want  to create a search viewlet or page with a form section containing
 [search field author, name  id = author]
 [search field subject, name  id = subject]
 [search field TextLine, name  id = subect]
 I thought about using a class derived from BaseForm or something like
 that to use the practical Fields(IArtFile). What is the best class to
 derive from?

 Then I have somehow to instruct the ICatalog Utility to combine the
 result from the indicies, I mean
 if subject is David and author Michelangelo and location
 Firenze, I want all the istances implementing IArtFile having these
 text lines in their attributes.
 I was thinking about converting the list returned by each
 catalog.apply function into set and then calculating the intersect
 function.
 Is there a better way to do it?
 ___
 Zope3-users mailing list
 Zope3-users@zope.org
 http://mail.zope.org/mailman/listinfo/zope3-users

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Interface confusion (still)

2008-07-15 Thread Shailesh Kumar
Hi,

I believe not. In any case, implements, provides and such things are more
like indications of what is being supported by a class and they are not
enforced by runtime strictly.

I just tried following:

#

from zope.component import *
from zope.interface import *
from zope.interface.verify import *

class IA(Interface): pass

class IB(IA): pass




class B(object):
implements(IB)


verifyClass(IA, B)  #returns True
verifyClass(IB, B) #returns True
verifyClass(Interface, B) #returns True



class IC(Interface) : pass

#


Its usually a good idea to setup unit tests for testing these kind of
things.

With regards,
- Shailesh

On 7/15/08, Tim Cook [EMAIL PROTECTED] wrote:

 If interface B inherits from interface A and class B implements
 interface B; do I need to explicitly state that class B provides
 interface A?

 Concrete example:

 class IElement(Interface):
 value = Object(
schema=IDataValue,
title=_(uvalue),
description=_(uData value of this leaf.),
required=False
)

 class IDvText(IDataValue):

 ...


 class DvText(DataValue):

 

 implements(IDvText)
 classProvides(IDvText)


 Will Element.value allow instances of DvText or do I need to change the
 DvText classProvides call to:

 classProvides(IDataValue,IDvText)

 Thanks,
 Tim





 --
 Timothy Cook, MSc
 Health Informatics Research  Development Services
 LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
 Skype ID == timothy.cook
 **
 *You may get my Public GPG key from  popular keyservers or   *
 *from this link http://timothywayne.cook.googlepages.com/home*
 **

 ___
 Zope3-users mailing list
 Zope3-users@zope.org
 http://mail.zope.org/mailman/listinfo/zope3-users



___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Disabling authentication for resources

2008-07-09 Thread Shailesh Kumar
Hi,

I have couple of following settings in my etc\securitypolicy.zcml

  role id=zope.Anonymous title=Everybody
 description=All users have this role implicitly /
  !-- Replace the following directive if you don't want public access --
  grant permission=zope.View
  role=zope.Anonymous /
  grant permission=zope.app.dublincore.view
  role=zope.Anonymous /

I didn't use zope.Public on my resource directories.

still able to acess them.

I use the older zope 3.3 zope instances.
Not sure if this helps you.
With regards,
- Shailesh


On Wed, Jul 9, 2008 at 5:44 PM, Roger Ineichen [EMAIL PROTECTED] wrote:

 Hi Andrew

  Betreff: Re: [Zope3-Users] Disabling authentication for resources

 [...]

 I guess bypass the authentication process is not supported for
 zope.Public protected objects.

 Zope does authenticate the user. And later it checks security
 for the object based on that user (authorization).

 zope.Public is correct for public access, but it doesn't mean
 the user get not authenticated. Remember authentication and
 authorization are two different things.

 I'm not really sure. But I guess without authentication,
 Zope doesn't know if even zope.Public is allowed for this
 user because you can deny permissions. But I'm also not sure
 without to introspect the code if zope.Public can set as deny.

 Hope that gives some hints for deep into the internals
 of IAuthentication. If you need a simpler implementation,
 take a look at z3c.authenticator.


 Regards
 Roger Ineichen

 
  On Tue, 2008-07-08 at 22:52 -0700, Shailesh Kumar wrote:
   Did you try the resourceDirecotry ZCML directive?
  
   browser:resourceDirectory
  
   name=js
  
   directory=resource/js
  
   layer=.interfaces.IBatonSkin
  
   /
   that way they don't need the authentication overhead.
 
  Thanks for the replies, everyone. This is what I currently
  have as an example of a resource I'm fetching:
 
resourceDirectory
name=ajs
directory=ajs
layer=vortex.layer.IVortexBrowserLayer
permission=zope.Public
/
 
  But if I try to access one of these resources directly from the web,
  e.g.:
 
  http://.../@@/ajs/gb_styles.css
 
  I still get my authentication code being called. I've tracked
  it down this far:
 
  (zope.app.publication:zope.publication.py)
 
  def _maybePlacefullyAuthenticate(self, request, ob):
  if not
  IUnauthenticatedPrincipal.providedBy(request.principal):
  # We've already got an authenticated user.
  There's nothing to do.
  # Note that beforeTraversal guarentees that user
  is not None.
  return
 
  if not ISite.providedBy(ob):
  # We won't find an authentication utility here,
  so give up.
  return
 
  sm = removeSecurityProxy(ob).getSiteManager()
 
  auth = sm.queryUtility(IAuthentication)
  if auth is None:
  # No auth utility here
  return
 
  # Try to authenticate against the auth utility
  principal = auth.authenticate(request)!- My
  PAU called
  here
 
  Any ideas ?
 
  Cheers, Andrew.
 

 ___
 Zope3-users mailing list
 Zope3-users@zope.org
 http://mail.zope.org/mailman/listinfo/zope3-users

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] OOBtrees ZODB

2008-07-08 Thread Shailesh Kumar
BTreeContainer doesn't support site managers.

Folder is a subclass of SiteManagerContainer which is a subclass of
BTreeContainer.

You can happily use Folder here.

With regards,
- Shailesh



On 7/8/08, Tim Cook [EMAIL PROTECTED] wrote:

 I am building a platform where I want to initialize the ZODB (that will
 be running under Zope) with three folders with sitemanagers.

 If I use Folders like this:

 if 'AR' not in root['Application']:
root['Application']['AR']=folder.Folder()
sm = LocalSiteManager(root['Application']['AR'])
root['Application']['AR'].setSiteManager(sm)
transaction.commit()

 it works great and I can then add initial objects to the folders.

 But, these folder sill potentially contain tens of thousands of objects
 so I really want to use BTree Folders.  But when I do this:

 from zope.app.container.btree import BTreeContainer

 ... lots of other stuff

 if 'AR' not in root['Application']:
root['Application']['AR']=BTreeContainer()
sm = LocalSiteManager(root['Application']['AR'])
root['Application']['AR'].setSiteManager(sm)
transaction.commit()

 I get this:

 File
 /home/tim/projects/ref_impl_python/TRUNK/oship/src/oship/atbldr/atbldr.py,
 line 78, in ?
root['Application']['AR'].setSiteManager(sm)
 AttributeError: 'BTreeContainer' object has no attribute
 'setSiteManager'

 So BtreeContainers don't have a siteManager.

 I would like to OOBTree but I have been unable to even discern the
 proper way to import it.

 Thanks.

 Tim





 --
 Timothy Cook, MSc
 Health Informatics Research  Development Services
 LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
 Skype ID == timothy.cook
 **
 *You may get my Public GPG key from  popular keyservers or   *
 *from this link http://timothywayne.cook.googlepages.com/home*
 **

 ___
 Zope3-users mailing list
 Zope3-users@zope.org
 http://mail.zope.org/mailman/listinfo/zope3-users



___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Disabling authentication for resources

2008-07-08 Thread Shailesh Kumar
Did you try the resourceDirecotry ZCML directive?


browser:resourceDirectory

name=js

directory=resource/js

layer=.interfaces.IBatonSkin

/

that way they don't need the authentication overhead.

On 7/8/08, andrew [EMAIL PROTECTED] wrote:

 Hi All,

 I've got a web application that uses pluggable authentication, but I
 don't want the overhead of authentication for public resources like CSS,
 javascript, images, etc. Is it possible to just disable authentication
 for a given resource ? I tried just setting the permission to zope.View,
 but that didn't seem to make any difference.

 Cheers, Andrew.

 ___
 Zope3-users mailing list
 Zope3-users@zope.org
 http://mail.zope.org/mailman/listinfo/zope3-users

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Cannot install Zope 3.3.0 as a Windows Service

2008-07-07 Thread Shailesh Kumar
Hi Joe,

Plone is based on zope2 (though it uses nowadays a lot of zope3 packages
also).

On Windows I usually avoid having both Plone/Zope2 and Zope 3. Most probably
zope 3 and zope 2 are conflicting in this case due to which you are not able
to see
 from zope.app.winservice.service import Service

which is a zope3 class.

My usual configuration on Windows is:
- Python 2.4
- Python for Windows extensions
- Zope 3
- Other Python packages which don't conflict with zope 3.  (PIL, reportlab
etc.)


With regards,
- Shailesh


On 7/7/08, Joe Bigler [EMAIL PROTECTED] wrote:

  Hi Shalesh,

 Thanks for the reply,

 Yes, I installed python 2.4 pywin32-211

 I did not use eggs or buildout.

 I can start it with runzope.bat

 Here is what I see in the ZMI under Runtime information

 Runtime Information Server Control Database Schemas ZODB Control
 Translation Domains Registration

 * Errors

 * Undo!

 * Undo more

 * Undo all

 * Help

 Uptime

 0 day(s) 02:00:09

 System platform

 Windows chm036 XP 5.1.2600

 Zope version

 3.3.0

 Python version

 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)]

 Command line

 C:\Zope\Instance\3.3.0\bin\runzope

 Preferred encoding

 cp1252

 FileSystem encoding

 mbcs

 Process id

 2272

 Python path

 * C:\Zope\Instance\3.3.0\lib\python

 * C:\Zope\2.9.8\Python\Lib\site-packages

 * C:\Zope\Instance\3.3.0\bin

 * C:\Program
 Files\Plone2.5.5\Python\lib\site-packages\setuptools-0.6c7-py2.4.egg

 * C:\Program
 Files\Plone2.5.5\Python\lib\site-packages\archgenxml-2.0-py2.4.egg

 * C:\ArchGenXML\src

 * C:\Program Files\Plone2.5.5\Zope\lib\python

 * C:\Program Files\Plone2.5.5\Python\python24.zip

 * C:\Zope\Instance\3.3.0\bin

 * C:\Program Files\Plone2.5.5\Python\DLLs

 * C:\Program Files\Plone2.5.5\Python\lib

 * C:\Program Files\Plone2.5.5\Python\lib\plat-win

 * C:\Program Files\Plone2.5.5\Python\lib\lib-tk

 * C:\Program Files\Plone2.5.5\Python

 * C:\Program Files\Plone2.5.5\Python\lib\site-packages

 * C:\Program Files\Plone2.5.5\Python\lib\site-packages\PIL

 * C:\Program Files\Plone2.5.5\Python\lib\site-packages\win32

 * C:\Program Files\Plone2.5.5\Python\lib\site-packages\win32\lib

 * C:\Program Files\Plone2.5.5\Python\lib\site-packages\Pythonwin

 * C:\Program Files\Plone2.5.5\Python\lib\site-packages\wx-2.6-msw-ansi

  --
 *From:* Shailesh Kumar [mailto:[EMAIL PROTECTED]
 *Sent:* Monday, July 07, 2008 9:54 AM
 *To:* Joe Bigler
 *Subject:* Re: [Zope3-Users] Cannot install Zope 3.3.0 as a Windows
 Service


  Do you have Python for Windows extensions installed?

 You may get it from : http://sourceforge.net/projects/pywin32/

 - Shailesh


 On 7/7/08, Joe Bigler [EMAIL PROTECTED] wrote:

  I am installing this on Windows XP, Service Pack 2

  Hello, I am looking for some help installing Zope 3.3.0 as a Windows
 service. When I run the C:\Zope\Instance\3.3.0python bin\zopeservice.py
 --startup auto install I get a message I placed in the paste
 http://paste.lisp.org/display/63370. I tried Zope IRC and I have looked
 in the Zope book and searched on line, but can't find anyone with this
 problem. Any suggestions are greatly appreciated

 Here is the message I pasted.

 C:\Zope\Instance\3.3.0python bin\zopeservice.py --startup auto install
 Traceback (most recent call last):
   File bin\zopeservice.py, line 84, in ?
 from zope.app.winservice.service import Service
 ImportError: No module named winservice.service

 Thanks,

 Joe Bigler




 ___
 Zope3-users mailing list
 Zope3-users@zope.org
 http://mail.zope.org/mailman/listinfo/zope3-users



___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Job opening (Noida, India)

2007-12-21 Thread Shailesh Kumar
Hi,

I apologize for posting on this list. I am posting here because I do not
know where else to post.

We at Interra Systems (Noida, India) are looking for one Zope3 engineer for
a full time position.

Anyone interested may please write directly to me.

With regards,
- Shailesh
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] A question regarding zope generations

2007-11-18 Thread Shailesh Kumar
Thanks Bernd,

I am working around this issues as you have suggested.

- Shailesh



On Nov 17, 2007 5:31 PM, Bernd Dorn [EMAIL PROTECTED] wrote:


  On 16.11.2007, at 13:56, Shailesh Kumar wrote:


 As of now, I am thinking of a following solution. For the current upgrade,
 I will have some code which will automatically evolve the existing
 installation during startup
 (i.e. DatabaseOpenedEvent) and actually assign a generation number in the
 root[generations_key]['product_name'] key.

 In the later upgrades, I will replace this with the regular schema
 manager.

 Comments from the zope 3 experts would be very useful.


 well this is a real flaw with generations ...

 in our projects we always add an initial .generations package to avoid
 such cases, you  can do this too, but it needs an intermediate version but
 no dummy schema manager.

 in generations/__init__.py you add

  from zope.app.generations.generations import SchemaManager

 pkg = 'myapp'

 schemaManager = SchemaManager(
 minimum_generation=0,
 generation=0,
 package_name=pkg)

 and register the manager.

 make a realease, this will set the generation to 0

 then add your first evolve1.py to generations, the manager stays the
 same  - you only have to increase the generation number

 regards, bernd






___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] A question regarding zope generations

2007-11-16 Thread Shailesh Kumar
Hi,

I have a small doubt regarding zope3 generations.

In the current way of doing things:
- one should first put a dummy schema manager, restart the zope, so that a
generation 0 is assigned to the application.
- one should then put the actual site specific schema manager which would
use the evolution scripts from this point onwards in development.

I essentially have a web based application product and the users have no
idea of zope and python as such. The product is shipped to them,
the installer installs the whole zope 3 instances and services by itself and
starts them.

For the upgrade case, the installer (NSIS based) stops existing zope 3
services (Win32), replaces the software and then restarts the services.

Unfortunately, I didn't have setup the dummy schema manager in the earlier
version of the product.

Now that I need to send an upgrade, I am facing the dilemma of how to setup
the evolution scripts. As doing that would require doing more complicated
processing
in the installer. (stop the services, put code for dummy schema manager,
start the services, ensure that database schema generation has  been setup
for the product,
stop the service again, put the new code and the regular schema manager,
start the service again).

This would complicate my installer a bit more. Its already quite
complicated.

I don't know if this is quite a common use case scenario for zope based
applications. I am sure its not relevant for applications which are based on
a website and managed
by an expert, but for products with zope built-inside, may be this could be
of use.

As of now, I am thinking of a following solution. For the current upgrade, I
will have some code which will automatically evolve the existing
installation during startup
(i.e. DatabaseOpenedEvent) and actually assign a generation number in the
root[generations_key]['product_name'] key.

In the later upgrades, I will replace this with the regular schema manager.

Comments from the zope 3 experts would be very useful.

Thanks a lot.
With regards,
- Shailesh
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] dynamicall javascript and css generation

2007-10-08 Thread Shailesh Kumar
Probably z3c.zrtresource might be of some use?

http://svn.zope.org/z3c.zrtresource/trunk/src/z3c/zrtresource/README.txt?rev=69512view=auto

- Shailesh


On 10/8/07, Yuan HOng [EMAIL PROTECTED] wrote:

 Hi,

 How do I dynamically generate javascript and css files and how to register
 them?

 ZPT doesn't seem to be a viable solution for generating these. DTML as
 far as I know is no longer available. So I think I should write a
 browser view to generate it in python with string formatting.

 Then how do I registered them? Using browser:page directive just like
 for a normal HTML page?
 But that would send text/html as the content type I guess, not
 text/javascript.

 What's the zope3's way of dynamicall script and css generation?

 --
 Hong Yuan

 大管家网上建材超市
 装修装潢建材一站式购物
 http://www.homemaster.cn

 ___
 Zope3-users mailing list
 Zope3-users@zope.org
 http://mail.zope.org/mailman/listinfo/zope3-users


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] xmlrpc access with PAU

2007-08-18 Thread Shailesh Kumar
Hi,

apart from Session Credentials, I would also have Zope Realm
Basic-Auth in my credentials plugin (as the last one).

For the normal browser based access, the session credentials plugin
does the work.

For XMLRPC access, I fall back on 'Zope Realm Basic-Auth'.

The URL for XMLRPC server proxy would include login and password
information like:

objProxy = xmlrpclib.Server('http://login:[EMAIL 
PROTECTED]:8080/path/to/object)
objProxy.method(arguments)

Hope this helps.

With regards,
-Shailesh


On 8/18/07, C. H. [EMAIL PROTECTED] wrote:


 I'm having difficulty accessing zope 3 objects using xmlrpc in my
 application, so
 I've gone back into the 22auth example of Phillip von Weitershausen's
 excellent book and
 made some simple modifications to elucidate my question in a simple
 environment
 which I describe here:

 created a zope 3 instance
created a site named wcsite
   created a folder named rfolder
  created a recipe named r1
  created a recipe named r2

 configured a PAU (at the wcsite level)
 with
 No Challenge if Authenticated
 Session Credentials

 created a Principal Folder named users

 Access using a browser works fine. If I attempt to access an object
 that an unauthenticated
 user has no access to, I'm presented with a login page and after
 logging in, I acquire and retain access
 until I logout. That's good.

 I modified Phillip's example python code worldcookery/xmlrpc/
 recipe.py to authenticate using
 a user=u1 and password=p1 (or so I think, hence my problem). That
 program is shown below.

 To test:
 First, in a browser I log in a manager and I edit the wcsite roles
 and permissions to grant the Site Manager role to All Users.

 then run
 displayandedit.py http://sasa.local:8080/wcsite/rfolder/r1

 This works fine, so I'm able to locate and access and edit the recipe
 data

 Next, (using a browser and logged in as the site manager)
 I edit the wcsite roles and permissions to UNSET the Site Manager
 role to All Users and
 grant  the Visitor of the WorldCookery website role to All Users.
 Further, I edit wcsite/rfolder/r1 to grant the Site Manager role to
 user u1
 So, the user r1 can read everything on the site but can only edit
 wcsite/rfolder/r1

 Now, I rerun displayandedit.py http://sasa.local:8080/wcsite/rfolder/r1
 and get an Unauthorized error:
 xmlrpclib.ProtocolError: ProtocolError for sasa.local:8080/wcsite/
 rfolder/r1: 401 Unauthorized

 It is my belief that I should be able to provide xmlrpc access to the
 r1 user in the recipe.py code
 but I can't figure out how. Can someone peruse the code below and
 suggest to me the
 appropriate technique? The edit method is the one that I modified to
 attempt to provide access.
 Thanks in advance.

 =Sample worldcookery/xmlrpc/recipe.py==
 import time
 import xmlrpclib
 from zope.schema import getFields
 from zope.dublincore.interfaces import IZopeDublinCore
 from zope.app.publisher.xmlrpc import XMLRPCView
 from zope.component import getUtility
 from zope.app.security.interfaces import IAuthentication
 from zope.app.authentication.interfaces import IPluggableAuthentication

 from worldcookery.interfaces import IRecipe

 def to_unicode(string):
 if isinstance(string, unicode):
 return string
 return string.decode('utf-8')

 class RecipeView(XMLRPCView):

 def info(self):
 return dict((field, getattr(self.context, field))
 for field in getFields(IRecipe)
 if field not in ('__parent__', '__name__'))

 def dublincore_info(self):
 dc = IZopeDublinCore(self.context)
 info = dict((field, getattr(dc, field))
 for field in getFields(IZopeDublinCore))
 for name in ('effective', 'created', 'expires', 'modified'):
 if info[name]:
 epochtime = time.mktime(info[name].timetuple())
 info[name] = xmlrpclib.DateTime(epochtime)
 else:
 info[name] = ''
 return info

 def edit(self, info, user, password):

 edit_return = 
 pau = getUtility(IAuthentication)
 #
 # make sure there is an authentication utility
 #
 if not IPluggableAuthentication.providedBy(pau):
 edit_return = # ERROR: No Pluggable Authentication
 Utility instance.
 return edit_return
 else:
 edit_return = \n +  # found a Pluggable
 Authentication Utility instace named  + pau.__name__
 #
 # get the authenticator plugin and authenticate credentials
 #
 for name, plugin in pau.getAuthenticatorPlugins():
 auth_creds =  plugin.authenticateCredentials({'login':
 user, 'password': password})
 edit_return = edit_return + \n#authenticated user:
 + auth_creds.login +  title: + auth_creds.title

 context = self.context
 context.name = to_unicode(info['name'])
 

Re: Re[2]: [Zope3-Users] possible bug in zope\app\authentication\principalfolder.py

2007-08-10 Thread Shailesh Kumar
Thanx a lot Adam and Christian.

With regards,
-Shailesh

On 8/10/07, Christian Theune [EMAIL PROTECTED] wrote:
 Hi,

 Am Donnerstag, den 09.08.2007, 14:32 +0530 schrieb Shailesh Kumar:
  Hi,
 
  Just another quick question on this. Is there any plan for new bug fix
  releases of 3.3 branch? or Will the next releases be on the 3.4
  branch?

 Zope 3.4 will receive a release candidate soon, but we need to do some
 more bugfixing. (If anybody is interested, help on fixing open bugs is
 always appreciated.)

 Zope 3.3 is currently maintained and will receive bugfix releases as
 necessary. The 3.3 branch might already incorporate fixes that haven't
 been released yet. In general, branches are maintained as long as their
 are people contributing fixes, the minimum amount of versions we support
 is two (currently Zope 3.3 and Zope 3.2).

 Christian


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] possible bug in zope\app\authentication\principalfolder.py

2007-08-09 Thread Shailesh Kumar
I have Zope 3.3.1 the official release.

With regards,
-Shailesh


On 8/9/07, Adam Groszer [EMAIL PROTECTED] wrote:
 Hello Shailesh,

 Which version of Z3 re you using?
 As I remember that was fixed, but I can't dig the info from SVN.

 Tuesday, August 7, 2007, 5:28:02 PM, you wrote:

  Hi,

  I was using InternalPrincipal object and specified a password with
  non-ascii characters.  Since Password is derived from TextLine, hence
  its supposed to be acceptable. But I found that if I use MD5 or SHA1
  password managers, it leads to problems. The following exception is
  thrown.

  I guess the password needs to be encoded in UTF8 before being hashed
  by md5 or sha1.

  File
  C:\Python24\Lib\site-packages\zope\app\authentication\principalfolder.py,
  line 124, in __init__ self.password = password
  File
  C:\Python24\Lib\site-packages\zope\app\authentication\principalfolder.py,
  line 144, in setPassword self._password =
  passwordManager.encodePassword(password)
  File
  C:\Python24\Lib\site-packages\zope\app\authentication\password.py,
  line 76, in encodePassword return md5.new(password).hexdigest()

  With regards,
  -Shailesh
  ___
  Zope3-users mailing list
  Zope3-users@zope.org
  http://mail.zope.org/mailman/listinfo/zope3-users



 --
 Best regards,
  Adammailto:[EMAIL PROTECTED]


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: Re[2]: [Zope3-Users] possible bug in zope\app\authentication\principalfolder.py

2007-08-09 Thread Shailesh Kumar
Hi,

Just another quick question on this. Is there any plan for new bug fix
releases of 3.3 branch? or Will the next releases be on the 3.4
branch?

With regards,
-Shailesh


On 8/9/07, Adam Groszer [EMAIL PROTECTED] wrote:
 Hello Shailesh,

 As I remember the fix was later.

 Thursday, August 9, 2007, 10:51:18 AM, you wrote:

  I have Zope 3.3.1 the official release.

  With regards,
  -Shailesh


  On 8/9/07, Adam Groszer [EMAIL PROTECTED] wrote:
  Hello Shailesh,
 
  Which version of Z3 re you using?
  As I remember that was fixed, but I can't dig the info from SVN.
 
  Tuesday, August 7, 2007, 5:28:02 PM, you wrote:
 
   Hi,
 
   I was using InternalPrincipal object and specified a password with
   non-ascii characters.  Since Password is derived from TextLine, hence
   its supposed to be acceptable. But I found that if I use MD5 or SHA1
   password managers, it leads to problems. The following exception is
   thrown.
 
   I guess the password needs to be encoded in UTF8 before being hashed
   by md5 or sha1.
 
   File
   C:\Python24\Lib\site-packages\zope\app\authentication\principalfolder.py,
   line 124, in __init__ self.password = password
   File
   C:\Python24\Lib\site-packages\zope\app\authentication\principalfolder.py,
   line 144, in setPassword self._password =
   passwordManager.encodePassword(password)
   File
   C:\Python24\Lib\site-packages\zope\app\authentication\password.py,
   line 76, in encodePassword return md5.new(password).hexdigest()
 
   With regards,
   -Shailesh
   ___
   Zope3-users mailing list
   Zope3-users@zope.org
   http://mail.zope.org/mailman/listinfo/zope3-users
 
 
 
  --
  Best regards,
   Adammailto:[EMAIL PROTECTED]
 
 

 --
 Best regards,
  Adammailto:[EMAIL PROTECTED]


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] a question about zope.app.security.principallogging.PrincipalLogging

2007-08-08 Thread Shailesh Kumar
Hi,

zope.app.security.principallogging.PrincipalLogging looks like:

class PrincipalLogging(object):

implements(ILoggingInfo)

def __init__(self, principal):
self.principal = principal

def getLogMessage(self):
return str(self.principal.id)


It requires that self.principal.id cannot be a UNICODE string (cannot
contain non-ascii characters).

Is this intentional???

With regards,
-Shailesh
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] possible bug in zope\app\authentication\principalfolder.py

2007-08-07 Thread Shailesh Kumar
Hi,

I was using InternalPrincipal object and specified a password with
non-ascii characters.  Since Password is derived from TextLine, hence
its supposed to be acceptable. But I found that if I use MD5 or SHA1
password managers, it leads to problems. The following exception is
thrown.

I guess the password needs to be encoded in UTF8 before being hashed
by md5 or sha1.

File C:\Python24\Lib\site-packages\zope\app\authentication\principalfolder.py,
line 124, in __init__ self.password = password
File C:\Python24\Lib\site-packages\zope\app\authentication\principalfolder.py,
line 144, in setPassword self._password =
passwordManager.encodePassword(password)
File C:\Python24\Lib\site-packages\zope\app\authentication\password.py,
line 76, in encodePassword return md5.new(password).hexdigest()

With regards,
-Shailesh
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] [Zope3.0] How to unregister an utility?

2007-06-09 Thread Shailesh Kumar

   from zope.component.globalregistry import getGlobalSiteManager
   gsm = getGlobalSiteManager()
   gsm.unregisterUtility(component=None, provided=None, name=u'')

Would that help?

With regards,
-Shailesh


On 6/9/07, Andreas Jung [EMAIL PROTECTED] wrote:

I have an application where I need to register and unregister a named
utility at runtime. In Zope 3.3 we have zope.component.unregisterUtility().
Is there something available in Zope 3.0 (as still used in Zope 2.8)?

Andreas

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users




___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] [Zope3.0] How to unregister an utility?

2007-06-09 Thread Shailesh Kumar

May be I am wrong. Didn't read the question properly ! Don't know
about Zope 3.0.

On 6/9/07, Shailesh Kumar [EMAIL PROTECTED] wrote:

   from zope.component.globalregistry import getGlobalSiteManager
   gsm = getGlobalSiteManager()
   gsm.unregisterUtility(component=None, provided=None, name=u'')

Would that help?

With regards,
-Shailesh


On 6/9/07, Andreas Jung [EMAIL PROTECTED] wrote:
 I have an application where I need to register and unregister a named
 utility at runtime. In Zope 3.3 we have zope.component.unregisterUtility().
 Is there something available in Zope 3.0 (as still used in Zope 2.8)?

 Andreas

 ___
 Zope3-users mailing list
 Zope3-users@zope.org
 http://mail.zope.org/mailman/listinfo/zope3-users





___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] how to get access to configuration context in Python?

2007-03-20 Thread Shailesh Kumar

Hi,

I ran into this small problem.

I had added a
meta:provides feature=afeature /

This works fine for controlling ZCML directives.

Now at some places in my Python code, I would like to query whether afeature
is available or not.
What is the way to access this?

Looking at ZMCL documentation of meta:provides, I could figure out that
zope.configuration.config.provides is used for registering the features.

But couldn't figure out if this information can be accessed later on.
Is it not possible to get this information later?

Any help would be appreciated.

Thanks in advance.

With regards,
-Shailesh
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] default page based on roles?

2007-02-28 Thread Shailesh Kumar

Hi,

Is it possible to control the default page for a particular object based on
the roles/permissions that a user has?

The browser:defaultPage directive as such doesn't support this.

Will I have to write a custom traverser or something like that for this?

Thanx in advance.

With regards,
-Shailesh
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Re: question about request.locale and creation time

2007-01-15 Thread Shailesh Kumar

I tried solving this problem as follows. Don't know if its the best
solution, but works for me as my application is meant only for Intranet
environments.


  - I subclassed zope.app.container.browser.contents.Contents.
  - In the subclass I overrided _*extractContentInfo *method
  - Created a LocalTimezone class as described in Python manual by
  subclassing tzinfo
  - Converted the created and modifed datetime objects from dublin-core
  information to local time zone
  - Used this class to create the Container views

The time information looks now fine for me.

Is there any better way?

With regards,
-Shailesh


On 1/15/07, Shailesh Kumar [EMAIL PROTECTED] wrote:


Sorry, the mail went only to Philipp by mistake.

Hi Philipp,
Thanx for the pointers. I went through the sections of your book regarding
this. I guess I now understand my problem better. The problem is about the
time-zone and not about formatting. The Creation and Modification time
stamps seem to be the UTC time stamps, and I want the display to be
according to local time zone.

How can I do it?

With regards,
-Shailesh



On 1/14/07, Philipp von Weitershausen [EMAIL PROTECTED]  wrote:



 Shailesh Kumar wrote:
  Hi,
 
  When I look at the Creation time and Modification time in any of the
  container views, it shows me the UTC time.
 
  Looking at
  zope.app.container.browser.contents.py
   http://zope.app.container.browser.contents.py: Line 174
 
  I found that:
 
  formatter = self.request.locale.dates.getFormatter(
  'dateTime', 'short')
 
  created = self.safe_getattr(dc, 'created', None)
  if created is not None:
  info['created'] = formatter.format(created)
 
  modified = self.safe_getattr(dc, 'modified', None)
  if modified is not None:
  info['modified'] = formatter.format(modified)
 
  is being used to compute them.

 No, the local formatter is used to *format* dates according to the
 current locale. 8th of March this year, for example would be 3/8/2007
 in the U.S. English locale, but 08.03.2007 in the German locale.

  I am puzzled, how does the browser set its locale? I guess this must
 be
  a very basic question. But I am not able to figure it out.

 request.locale is set according to the most preferred language/locale
 returned by the IUserPreferredLanguages adapter for the request. The
 default adapter reads browser's the Accept-Language header. More
 advanced adapters could use cookies or something else that the user can
 influence though the website directly.

 My book talks about this in detail: http://worldcookery.com


 --
 http://worldcookery.com -- Professional Zope documentation and training
 2nd edition of Web Component Development with Zope 3 is now shipping!



___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] question about request.locale and creation time

2007-01-13 Thread Shailesh Kumar

Hi,

When I look at the Creation time and Modification time in any of the
container views, it shows me the UTC time.

Looking at
zope.app.container.browser.contents.py: Line 174

I found that:

   formatter = self.request.locale.dates.getFormatter(
   'dateTime', 'short')

   created = self.safe_getattr(dc, 'created', None)
   if created is not None:
   info['created'] = formatter.format(created)

   modified = self.safe_getattr(dc, 'modified', None)
   if modified is not None:
   info['modified'] = formatter.format(modified)

is being used to compute them.

I am puzzled, how does the browser set its locale? I guess this must be a
very basic question. But I am not able to figure it out.

Could anyone please explain?

With regards,

-Shaliesh
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] ConnectionStateError when a worker thread finishes

2007-01-08 Thread Shailesh Kumar

Thanx for the guidance.

I did figure out that the whole problem was happening because of threads
trying to access the ZODB. For the time being, I got rid of that, and had a
separate sheduler event which queries the background threads to get update
information and put it in the ZODB. It seems to work well.

With regards,
-Shailesh



On 1/8/07, Stephan Richter [EMAIL PROTECTED] wrote:


On Wednesday 03 January 2007 05:46, Shailesh Kumar wrote:
 In my application, some background threads are being created. But when a
 thread finishes up its work, a strange exception is thrown:
 The callstack doesn't show any part of my application code.

You have to use threads very carefully, if they modify the database. The
correct way is to create a new connection to the ZODB do your work, commit
the transaction and close the connection. Pretty much copy what the
publisher
does. Another alternative is to create a new publisher request of course.

Regards,
Stephan
--
Stephan Richter
CBU Physics  Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] ConnectionStateError when a worker thread finishes

2007-01-03 Thread Shailesh Kumar

Hi,
In my application, some background threads are being created. But when a
thread finishes up its work, a strange exception is thrown:
The callstack doesn't show any part of my application code.
=
Traceback (most recent call last):
 File C:\Python24\Lib\site-packages\zope\server\taskthreads.py, line 48,
in handlerThread
   task.service()
 File C:\Python24\Lib\site-packages\zope\server\serverchannelbase.py,
line 207, in service
   task.service()
 File C:\Python24\Lib\site-packages\zope\server\http\httptask.py, line
71, in service
   self.channel.server.executeRequest(self)
 File C:\Python24\Lib\site-packages\zope\server\http\wsgihttpserver.py,
line 63, in executeRequest
   task.write(self.application(env, start_response))
 File C:\Python24\Lib\site-packages\zope\app\wsgi\__init__.py, line 55,
in __call__
   request = publish(request, handle_errors=handle_errors)
 File C:\Python24\Lib\site-packages\zope\publisher\publish.py, line 183,
in publish
   request.close()  # Close database connections, etc.
 File C:\Python24\Lib\site-packages\zope\publisher\base.py, line 301, in
close
   held.release()
 File
C:\Python24\Lib\site-packages\zope\app\publication\zopepublication.py,
line 60, in release
   self._f()
 File C:\Python24\Lib\site-packages\ZODB\Connection.py, line 235, in
close
   raise ConnectionStateError(Cannot close a connection joined to 
ConnectionStateError: Cannot close a connection joined to a transaction
=
My worker thread are created using threading.Thread based classes.

Does anybody throw some light about this error?

Thanx for your help.

With regards,
-shailesh
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] server shutdown event

2006-12-01 Thread Shailesh Kumar

Hi,

I wanted to do some cleanup activities during the time of server shutdown.
Couldn't find any particular event that is sent at that time. But looking
at: zope.app.main.main, i tried:

from twisted.internet import reactor

def shutdown():
 #shutdown code here.
  pass

reactor.addSystemEventTrigger('before',
   'shutdown', shutdown)

and this seems to work. (did this under an event handler for
DatabaseOpenedWithRootEvent).

Just want to confirm, is it the right way to do, or there is some better way
to do things?

With regards,
-Shailesh
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] how to know which port zope is runnning on?

2006-11-29 Thread Shailesh Kumar

I have 2 different zope applications running (on different machines) and
they would be talking to each other, one is a master application and there
may be multiple instances of the other one (on different machines). I need
the port number information for registing one with another programmatically.
don't want to fix port numbers for them.

Looking at the zope code I found that from
zope.app.server.servertype.IServerType utilities, default port number is
seen which gets overriden during the create() function call, but the
overriden port number (obtained from zope.conf) is not available as such (I
couldn't figure out how it can be accessible). Probably I can get it by
parsing zope.conf again in my code.

With regards,
-shailesh

On 11/29/06, Chris Withers [EMAIL PROTECTED] wrote:


Shailesh Kumar wrote:
 Thanx for the hint. I still don't know how to programmatically access
the
 event log. will try to figure it out.

Why do you need to know programmatically?

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] how to know which port zope is runnning on?

2006-11-28 Thread Shailesh Kumar

Hi,

Is it possible for the application code to figure out the port number on
which zope is running? What is the suitable api for that?

With regards,
-shailesh
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] how to know which port zope is runnning on?

2006-11-28 Thread Shailesh Kumar

Thanx for the hint. I still don't know how to programmatically access the
event log. will try to figure it out.

With regards,
-shailesh



On 11/28/06, Chris Withers [EMAIL PROTECTED] wrote:


Shailesh Kumar wrote:
 Thanx Tom,  but I was looking for the general case, not in the context
of a
 request. Like say during application startup I want to know the port
 number.
 Is it possible?

This is surely in the event log, why don't you look there?

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] question about MailDir folder for queuedDelivery on windows

2006-11-17 Thread Shailesh Kumar

Hi,

I am trying to use mail:queuedDelivery. It says that the
*...\lib\python\baton\mail_queue is not a Maildir folder*

I am using Zope on Windows-XP box. How can I setup a Maildir folder?

With regards,
-shailesh
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] how to access the root folder in normal operation

2006-11-17 Thread Shailesh Kumar

Hi,

zope.traversing.api.getRoot  returns the root of a given object. What I
wanted to do was that when zope starts, I would like to create a few content
objects inside the root folder.

Something like:
root = getRootFolder() #using some way I don't know.
root['etc'] = Folder()
root['var'] = Folder()
...

Is it possible to do that?

With regards,
-shailesh



On 11/15/06, Tom Gross [EMAIL PROTECTED] wrote:


Hi Shailesh,

   have a look at zope.traversing.api. There's a getRoot-method.

Cheers
-Tom

Shailesh Kumar wrote:
 Hi,

 In a functional test setup, one can access the root folder using
 getRootFolder() of FunctionalTestSetup.

 How  can I access the root folder in a nomal operation mode? Is there
 some mechanism to do that?

 Thank you very much.

 With regards,
 -shailesh




 

 ___
 Zope3-users mailing list
 Zope3-users@zope.org
 http://mail.zope.org/mailman/listinfo/zope3-users


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] how to access the root folder in normal operation

2006-11-17 Thread Shailesh Kumar

Thank you very much. This technique works perfectly.

-shailesh


On 11/17/06, Thierry Florac [EMAIL PROTECTED] wrote:


Le vendredi 17 novembre 2006 à 16:59 +0530, Shailesh Kumar a écrit :
I currently use something like this, to handle a site configuration on
startup (define catalog indexes...) :

   from zope.app.appsetup.interfaces import \
   IDatabaseOpenedWithRootEvent
   from zope.app.publication.zopepublication import ZopePublication
   from zope.component import adapter

   @adapter(IDatabaseOpenedWithRootEvent)
   def handleDatabaseOpenedWithRootEvent(event):
   db = event.database
   connection = db.open()
   root = connection.root()
   root_folder = root.get(ZopePublication.root_name, None)
   ...

And in ZCML :

   subscriber
   handler=.handleDatabaseOpenedWithRootEvent /


Thierry Florac
--
Chef de projet intranet/internet
Office National des Forêts - Département Informatique
2, Avenue de Saint-Mandé
75570 PARIS Cedex 12
Mél : [EMAIL PROTECTED]
Tél. : +33 01.40.19.59.64
Fax. : +33 01.40.19.59.85


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] how to access the root folder in normal operation

2006-11-15 Thread Shailesh Kumar
Hi,

In a functional test setup, one can access the root folder using getRootFolder() of FunctionalTestSetup. 

How can I access the root folder in a nomal operation mode? Is there some mechanism to do that? 

Thank you very much. 

With regards,
-shailesh




___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] question about ftesting.zcml

2006-11-10 Thread Shailesh Kumar
Hi, 
A small question about functional testing. 

What is the purpose of ftesting.zcml ? Do I need to put something in
this file for running functional tests? Or it needs to have just
configure/configure? 

Thanx in advance.

With regards,
-shailesh

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] questions about placelesssetup

2006-11-09 Thread Shailesh Kumar
Dear zope experts, 

I have some doubts regarding the working of placelesssetup. I am not familiar with its workings. 

Is it ok to run a placelesssetup when a zope instance is already running? 

Does it create its own site structure in memory? (I saw a buildSampleFolderTree in zope.app.testing.setup).

Does all the content created during placelesssetup go away when the test using placelesssetup finishes? 


Thank you very much.

With regards,
-shailesh

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: how to get zope shutdown event and do some actions at that time?

2006-11-08 Thread Shailesh Kumar
Thank you Phillip,

Just for curiosity, is this zc.async package always going to be a third party or is there any plan of making the
package part of regular zope distribution? 

With regards,
-shailesh
On 11/8/06, Philipp von Weitershausen [EMAIL PROTECTED] wrote:
Shailesh Kumar wrote: In my zope based application, I want to do some periodic actions. I couldn't find out any timer kind of facility in zope.There's a third party package, zc.async, that may solve this problem:
http://svn.zope.org/zc.async/trunk/src/zc/async/--http://worldcookery.com -- Professional Zope documentation and training
___Zope3-users mailing listZope3-users@zope.orghttp://mail.zope.org/mailman/listinfo/zope3-users

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Re: how to get zope shutdown event and do some actions at that time?

2006-11-07 Thread Shailesh Kumar
One way I can do it is by registering a utility whose 





__del__(
self)

method is overridden. 

Is it a recommended method? 

With regards,
-shailesh
On 11/8/06, Shailesh Kumar [EMAIL PROTECTED] wrote:
Dear zope experts, 

In my zope based application, I want to do some periodic actions. I
couldn't find out any timer kind of facility in zope. I was thinking
that I could start a thread in the beginning which would work as a
timer and create an event on periodic basis. Different subscribers to
the event would then be activated which would carry out their piece of
work. 
I would like to have a clean close up of this thread when zope shuts down. But I couldn't find out how to do that. 
Is there some way to setup some tear down cleanup operations in my application?

Thanks for your help. 

With regards,
-shailesh





___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Logout button missing in ZMI

2006-11-06 Thread Shailesh Kumar
Hi, 

I don't know what I did but I cannot find the logout button in my ZMI.
So, I am not able to change login without closing the browser. Is there
something which enables or disables this button in ZMI?
All help is appreciated. 

With regards,
-shailesh




___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] some basic questions about utility

2006-11-05 Thread Shailesh Kumar
Hi all, 

Could you please clarify some basic doubts about the usage of utilities? Here they are. 

Suppose I have registered a utility using ZCML directive in my web application. 

Is the utility created the moment zope starts up, during the parsing of
my app's ZCML? Can I think of it as a singleton instance? 

Can I do some application specific startups like running some background threads for some tasks in the __init__ of my utility? 


Thank you very much

With regards,
-shailesh

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] A system error occurred message

2006-11-04 Thread Shailesh Kumar
Hi all, 
I am a new zope3 user. I am running zope3 in developer mode with
runzope command. A number of times (off course when I am doing
something wrong) it happens that zope3 gives a blank page with just one
line information: 
'A system error occurred'

Is there some mechanism to be able to see more details about this system error in the browser itself? 


With regards,
-shailesh

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users