Re: [Zope-dev] zope generations updating objects with method name change

2013-03-11 Thread Joshua Immanuel
Hello Tres,

Thanks for the reply.

On Sun, 2013-03-10 at 23:32 -0400, Tres Seaver wrote:
 Method names are not stored in the ZODB at all:  only the instance
 attributes are stored.

Apologies. I've reported it wrong. I was not able to reproduce the
problem after a fresh start.

-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] zope generations updating objects with method name change

2013-03-10 Thread Joshua Immanuel
Hello,

My application is based on Grok. Whenver, I change a method-name or add
a method to a Model, Grok fails to load the previous version from the
ZODB. I resorted to writing simple generations (zope.generations) to
update the stored model objects.

For 'method name' changes, this basically means:
 1. create new object
 2. copy every single attribute of old-object to the new-object
 3. delete old-object
 4. save new-object 

How does everyone else do this? Or is there a way to make grok/zope/zodb
not persist the method-names and signatures in a content component (grok
Model)?

-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] zope.org upgraded

2012-11-14 Thread Joshua Immanuel
Hello Johannes,

On Sat, 2012-11-10 at 20:54 +0100, johannes raggam wrote:
 If you have some comments and suggestions regarding zope.org, drop me
 a mail.

The pages from top-level navigation links such as sitemap,
accessibility-info, contact-info and site search toolbar's text are not
in English. Please make English as default language.

Thank you.
-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Zope Toolkit - 1.0.6 and 1.1.4 released

2012-02-13 Thread Joshua Immanuel
Hello Hanno,

On Mon, 2012-02-13 at 14:25 +0100, Hanno Schlichting wrote:
 Sure, that would be helpful. Unfortunately nobody has volunteered to
 write a script to produce such a changelog. You can download and diff
 the files at http://download.zope.org/zopetoolkit/index/ yourself.
 
 But in general there's no important changes in the ZTK maintenance
 releases, unless you've been tracking a specific issue relevant to one
 of your applications.

Thanks for the info.

Regards
Joshua
-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Zope Toolkit - 1.0.6 and 1.1.4 released

2012-02-13 Thread Joshua Immanuel
Hello Hanno,

On Mon, 2012-02-13 at 13:45 +0100, Hanno Schlichting wrote:
 On behalf of the Zope Toolkit release team and the Zope community, I'm
 happy to announce the release of the Zope Toolkit 1.0.6 and 1.1.4. 

Wonderful!!. It would be very helpful if there is a changelog associated
with it. So, that we can know the important changes that have taken
place in associated packages.

Regards
Joshua
-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Passing variable across pages

2011-09-21 Thread Joshua Immanuel
Hello Hanno,

Please excuse my off-topic post.

On Wed, 2011-09-21 at 13:41 +0200, Hanno Schlichting wrote:
 Please post your question to the users mailing list at
 https://mail.zope.org/mailman/listinfo/zope
 
 This mailing list is for the development of Zope, not development with
 Zope. 

As I always cross post to both zope-dev@zope.org and bluebr...@zope.org
for my doubts pertaining to bluebream and ZTK. I was wondering which
mailing list that I should stick to for the queries related to bluebream
and ZTK. Moreover I see not so active zope3-us...@zope.org mailing list
on the net.

But as a matter of fact, the solutions that I got for most of my queries
were from zope-dev mailing list users. So, it was impossible for me to
let go of this mailing list even though I see the no cross posts tag
in the mail.

After seeing this mail, I've started to think whether I should stop
cross posting in my future mails and which mailing list should I single
out. Please advice.

Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] locatability of objects inside a list in bluebream

2011-08-25 Thread Joshua Immanuel
Hello all,
I have a following interface definitions

class IMyListObject(Interface):

name = TextLine(
title=u'Name')

class IMyObject(Interface):

name = TextLine(
title=u'Name')

...

my_list = List(
title=u'My Object list',
value_type=Object(
title='My List Object',
schema=IMyListObject)
)

For adding the 'IMyListObject' into the my_list of 'IMyObject' I created
a browser page for 'IMyObject' with zope.formlib AddForm's form_fields
set to 'IMyListObject' and appended them to the 'my_list' field. That
part works great.

But I like to know, what is the preferred way of making objects inside
the 'my_list' to be locatable. So that I can have an edit page or a
display page for the 'IMyListObject' in that list.

One approach what I thought was to make 'IMyObject' as a container with
all other schema fields in place except the 'my_list' field and add the
'IMyListObject' to the 'IMyObject' as child objects, so that all the
'IMyListObject' objects are locatable.

But I really wanted to know if it is possible to make objects inside a
list locatable as that would be necessary in the case of creating an
object tree of the following format.

class INode(Interface):

parent = Object(
title=uParent node,
schema=Interface
)

children = List(
title=u'Child nodes',
value_type=Object(schema=Interface)
)
INode['parent'].schema = INode
INode['children'].value_type.schema = INode

Please guide me in this regard.

[Sorry for always cross posting to both bluebream and zope-dev mailing
lists. Also I find another not so active zope3-users mailing list
available. As most of my queries gets answered from zope-dev mailing
list I am still in confusion on which mailing list to single out. Kindly
bear with me.]

Regards
-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] [BlueBream] locatability of objects inside a list in bluebream

2011-08-25 Thread Joshua Immanuel
Hello Michael,

Thanks for the reply.

On Thu, 2011-08-25 at 10:57 +0200, Michael Howitz wrote:
 The list and the objects inside the list both have to implement
 zope.location.interfaces.ILocation.
 To traverse to the `my_list` object you might use the ++attribute++
 traverser.
 To traverse from the list to its content objects you might need your
 own traverser (not sure if it works out of the box).
 
 Again an older German blog entry might help:
 http://blog.gocept.com/benutzung-des-attribute-namespaces-in-zope3
 

I'll check and get back. I think I'll have to read all your posts under
the category zope3 :)

Regards
-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] getting size of zope.schema.List from a view in bluebream

2011-08-23 Thread Joshua Immanuel
Hello all,
While trying to get the length of zope.schema.List field in a view
(like this: len(self.context.list_field) I get the following error

ForbiddenAttribute: ('__len__', [])

Even though my zcml configuration for that class is defined as below

  class class=.app.MyObject

require
permission=zope.Public
interface=.interfaces.IMyObject
/

require
permission=zope.Public
set_schema=.interfaces.IMyObject
/
  /class

I still get the above error. To circumvent this issue, I added a method
in the interface like say 'getListSize()' which has the following
implementation

class MyObject(persistent.Persistent):
implements(IMyObject)

name = u''
list_field = PersistentList()
...

def getListSize(self):
return len(self.list_field)

This solves my issue. However, I am curious to know whether is this the
only solution available to the above issue. Am I going in the right
direction?

Please guide me.

-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] getting size of zope.schema.List from a view in bluebream

2011-08-23 Thread Joshua Immanuel
Hello all,
On Tue, 2011-08-23 at 13:16 +0530, Joshua Immanuel wrote:
 def getListSize(self):
 return len(self.list_field)
 
 This solves my issue. 

This solves just the '__len__' issue. But if do the slice operation like
this

self.context.list_field[offset:limit]

I get the following error

ForbiddenAttribute: ('__getslice__',[...])

I guess my approach is flawed. Implementing all the functionality (like
the one I did for length) that a list provides is a overkill. So, please
guide me in this regard.

Thanks
-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] getting size of zope.schema.List from a view in bluebream

2011-08-23 Thread Joshua Immanuel
Hello Charlie,

Thanks for the reply.

On Tue, 2011-08-23 at 13:56 +0200, Charlie Clark wrote:
 I think it's really difficult to work out what you are trying to do.  
 Please state your problem more clearly. Are you still using zope.form
 or are you using z3c.form? 

I am still using zope.formlib. I guess I found the root of the problem.
All the schema fields are security proxied I guess. Removing the
security proxy from those fields before accessing the field's inbuilt
methods solves the problem. So, my code now looks like this

from zope.security.proxy import removeSecurityProxy

sz = len(removeSecurityProxy(self.context.list_field))
...

li = removeSecurityProxy(self.context.list_field)
res = li[offset:limit]

I guess this is a cleaner approach.

Regards
-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] getting size of zope.schema.List from a view in bluebream

2011-08-23 Thread Joshua Immanuel
Hello Adam,

Thanks for the reply.

On Tue, 2011-08-23 at 14:39 +0200, Adam GROSZER wrote:
 Well using removeSecurityProxy is not so nice.
 
 If there's really a list in your property, then zope should give you 
 zope.Public access:
 
 _default_checkers = {
 ...
  list: NamesChecker(['__getitem__', '__getslice__', '__len__', 
 '__iter__',
  '__contains__', 'index', 'count', '__str__',
  '__add__', '__radd__', ]),
 ...
 
 Can you do:
 
from zope.security.proxy import removeSecurityProxy
 
li = removeSecurityProxy(self.context.list_field)
   print type(li) 

As I am using the persistent List in the implementation of IMyObject,
the output of the above is

class 'persistent.list.PersistentList'

So, How can I access its inbuilt methods without removing the security
proxy. Please guide me.

Regards
-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] [BlueBream] getting size of zope.schema.List from a view in bluebream

2011-08-23 Thread Joshua Immanuel
Hello Adam,

On Tue, 2011-08-23 at 15:13 +0200, Adam GROSZER wrote:
 class class=persistent.list.PersistentList
 allow attributes=__getitem__ __getslice__ __len__ __iter__
__contains__ index count data /
 /class
 
 Should do it. (but beware I did not test!)
 
 That is in zope.app.security/_protections.zcml
 
 Might be that you'd need to include that package. 

Yes. Including that file in zcml solved the issue.

include package=zope.app.security file=_protections.zcml /

Apart from the PersistentList and PersistentDict I see many other BTree
related allow attributes configurations. I guess these configurations
are not available in any other place and including this
'_protections.zcml' is safe.

Thanks for the tip.

Regards
-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] [BlueBream] disabling zope.schema constraint check in edit form

2011-08-19 Thread Joshua Immanuel
Hello Michael,

On Thu, 2011-08-18 at 12:46 +0200, Michael Howitz wrote:
 Some time a ago I wrote a blog post about objects with attributes
 which are unique in their container [1].
 Besides it is written in German you might get the clue from the code
 examples.
 
 
 [1]
 http://blog.gocept.com/zope3-objekte-mit-eindeutigen-titeln-innerhalb-eines-ordners
 

Thanks for your excellent article. Google translate helped me to
understand your German text :)

Instead of going via the constraint approach I will try using your
approach. 

I see many people using z3c.form it makes me wonder whether to follow
their trail or to stick with zope.formlib. 

-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] disabling zope.schema constraint check in edit form

2011-08-18 Thread Joshua Immanuel
Hello all,

I use the zope.schema field's constraint parameter to check for the
uniqueness of a particular field like this

class IMyObject(Interface):

def check_for_uniqueness(value):
cat = getUtility(ICatalog)
results = cat.searchResults(object_name=value)
for rslt in results:
if rslt.name.lower() == value.lower():
raise NameAlreadyExists(value)
return True

name = TextLine(title=u'Name', required=True,
constraint=check_for_uniqueness)
...

This goes well with the zope.formlib's AddForm. But in edit form if I
modify any other field other than the 'name' field I get the
'NameAlreadyExists' error. Worse case scenario is where I have a cancel
action button which just redirects to another page, that too screams for
the NameAlreadyExists error.

Is there a way to disable the constraint check in the EditForm if the
'name' field isn't modified?

What is the preferred way of doing these kind of checks?

Please guide me.

-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] [BlueBream] disabling zope.schema constraint check in edit form

2011-08-18 Thread Joshua Immanuel
Hello Michael,

Thanks for the reply.

On Thu, 2011-08-18 at 12:46 +0200, Michael Howitz wrote:
  Is there a way to disable the constraint check in the EditForm if
  the 'name' field isn't modified?
 
 Make sure your catalog search does not return the object you are
 currently editing.

Yes. But considering the fact that I am doing this check at the
interface level. I wonder if that is ever possible, because the
constraint method knows just the value of the field.

  What is the preferred way of doing these kind of checks?
 
 Some time a ago I wrote a blog post about objects with attributes
 which are unique in their container [1].
 Besides it is written in German you might get the clue from the code
 examples.
 
 
 [1]
 http://blog.gocept.com/zope3-objekte-mit-eindeutigen-titeln-innerhalb-eines-ordners

I'll check this and get back.

Regards
Joshua
-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] disabling zope.schema constraint check in edit form

2011-08-18 Thread Joshua Immanuel
Hello Leonardo,

On Thu, 2011-08-18 at 19:10 +0200, Leonardo Rochael Almeida wrote:
 For the 'cancel button' case, you need to have a form action with a
 validator that always validates, no matter what. You can find an
 example of one such null_validator here:
 
 https://svn.plone.org/svn/plone/plone.app.form/tags/2.0.3/plone/app/form/validators.py
 
 To use it, you do something like
 
 class MyForm(...):
 
   @form.action(..., validator=null_validator):
   def handle_cancel(self, ...)
 [... do the redirect ...] 

Thanks for the useful tip. I'll use this :)

Regards
Joshua
-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] [BlueBream] pagination in bluebream

2011-08-13 Thread Joshua Immanuel
Hello all,

Thanks for the replies.

On Fri, 2011-08-12 at 10:34 -0400, Tres Seaver wrote:
 That is the accepted mode.  For many applications using pagination,
 the percentage of page views which ever use anything but the first
 batch is pretty tiny.  Note as well that zope.catalog returns its
 result as sets of document IDs, rather than the real objects, so you
 don't pay the cost of pulling the early items into the object cache:
 you only need to reify the objects for the current batch.

Then I will go with catalog approach. In this regard I need one more
clarification. 

Say I have an object with following interface

class IMyObject(Interface):

id = TextLine(title=u'Object ID')
name = TextLine(title=u'Name')
...

and say I have registered the catalog like this

catalog['object_id'] = TextIndex('id', IMyObject)

The 'id' field is same as the key value under which the MyObject is
stored in its parent container. And say if the 'id' field value always
starts with a 'p' so its values are like 'p0001', 'p0002' etc.
So, while searching the catalog I query like this

catalog.apply({'object_id': 'p*'})

I get all the objects from the container as desired :) My problem is
solved, but out of curiosity I am asking this. If I query like this

catalog.apply({'object_id': '*'})

I get the following error 

ParseError: Query contains only common words: '*'

So, How do I query a catalog to return all its objects? 

I guess I can trust the order of objects returned while querying with
_limit option. Because I will be querying for the same keywords n number
of times with just the changing _limit values. Am I right?

Is there any detailed documentation explaining the query format to be
used while querying the catalog other than the documentation in pypi of
zope.catalog?

Thanks

Regards
-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] pagination in bluebream

2011-08-12 Thread Joshua Immanuel
Hello all,

I am trying to list out items in a container, as the number of objects
in the container may be large I am trying to paginate them. Basically I
am trying to implement something like 'LIMIT' and 'OFFSET' option
available in SQL.

I found z3c.batching package that does this. For this to work it needs
the full list. IMHO, loading the entire list of objects on to the memory
doesn't seem to be a good choice.

I tried to use zope.catalog to get the object list. But, it has just the
_limit option to control the output size. And again manipulating the
_limit value to [offset + limit] and then trimming the results doesn't
seem to be a clean approach.

Is there any other better way of doing this?

-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] [BlueBream] Referring to same interface using zope.schema.Object

2011-07-22 Thread Joshua Immanuel
Hello,

On Fri, 2011-07-22 at 13:41 +0200, Jacob Holm wrote:
 On 2011-07-22 13:26, Brian Sutherland wrote:
  This would be my first guess:
  
  class INode(Interface):
  pass
   
  INode.parent = Object(
  title=uParent node,
  schema=INode
  )
  
  INode.children = List(
  title=u'Child nodes',
  value_type=Object(schema=INode)
  )
  
 

The method suggested by Brian works without any issues. :)

 
 And that guess would be wrong.  You can't add fields to an existing
 schema like that (not sure if you can in other ways).  You *can*
 change
 an existing field however, so a working solution would be:
 
 class INode(Interface):
 
 parent = Object(
 title = u'Parent node',
 schema = Interface, # set to INode later
 )
 
 children = List(
 title = u'Child nodes',
 value_type = Object(schema=Interface), 
 )
 
 INode['parent'].schema = INode
 INode['children'].value_type.schema = INode 

I thought this also should work without any issues. But when I ran the
debug shell to list out the attributes of INode using dir(INode) I
couldn't find the 'parent' and 'children' attributes in it. Even worse
part is, if there is another field say

name = TextLine(title=u'Node name')

This 'name' attribute is also is not visible along with 'parent' and
'children' attributes.

Can someone explain why is this so?

(Even though the problem gets solved by Brian's method, just curious to
know)
-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] [BlueBream] Referring to same interface using zope.schema.Object

2011-07-22 Thread Joshua Immanuel
Hello Laurence,

On Fri, 2011-07-22 at 13:57 +0100, Laurence Rowe wrote:
 No, there are issues. Take this example:
 
  class ITest(Interface):
 ...  title = schema.TextLine()
 ...
  ITest.names
 bound method InterfaceClass.names of InterfaceClass __main__.ITest
  ITest.names()
 ['title']
  ITest.description = schema.Text()
  ITest.names()
 ['title']
 
 The fields on an interface are not stored as attributes, but are
 accessible using item access, e.g: ITest['title']. You cannot assign
 that way though:
 
  ITest['description'] = schema.TextLine()
 Traceback (most recent call last):
   File console, line 1, in module
 TypeError: 'InterfaceClass' object does not support item assignment
 
 Adding to an interface requires messing with the
 '_InterfaceClass__attrs' attribute of the dictionary and is
 discouraged. 

Thanks for enlightening me with this wonderful explanation. 

As Jacob mentioned, list(INode) in debug shell was very handy to debug.

-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] [BlueBream] Referring to same interface using zope.schema.Object

2011-07-22 Thread Joshua Immanuel
Hello Laurence,

On Fri, 2011-07-22 at 13:57 +0100, Laurence Rowe wrote:
 No, there are issues. Take this example:
 
  class ITest(Interface):
 ...  title = schema.TextLine()
 ...
  ITest.names
 bound method InterfaceClass.names of InterfaceClass __main__.ITest
  ITest.names()
 ['title']
  ITest.description = schema.Text()
  ITest.names()
 ['title']
 
 The fields on an interface are not stored as attributes, but are
 accessible using item access, e.g: ITest['title']. You cannot assign
 that way though:
 
  ITest['description'] = schema.TextLine()
 Traceback (most recent call last):
   File console, line 1, in module
 TypeError: 'InterfaceClass' object does not support item assignment
 
 Adding to an interface requires messing with the
 '_InterfaceClass__attrs' attribute of the dictionary and is
 discouraged. 

Thanks for enlightening me with this wonderful explanation. 

As Jacob mentioned, list(INode) in debug shell was very handy to debug.

-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in



signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] error while installing zope.viewlet via buildout in bluebream

2011-07-11 Thread Joshua Immanuel
Hello,

I am finding it hard to install zope.viewlet package via buildout. Here
is my buildout configuration snippet

[zopeextras]
recipe = zc.recipe.egg
eggs = zope.catalog
   zope.viewlet

[app]
recipe = zc.recipe.egg
eggs = testbb
   z3c.evalexception=2.0
   Paste
   PasteScript
   PasteDeploy
   ${zopeextras:eggs}
interpreter = bbpy

...

I get the following error while running buildout

Getting distribution for 'zope.viewlet==3.7.2'.
install_dir /home/joshua/mudpit/testbb/eggs/tmpv7F8Bd
error: None
An error occured when trying to install zope.viewlet 3.7.2. Look
above this message for any errors that were output by
easy_install.
While:
  Installing zopeextras.
  Getting distribution for 'zope.viewlet==3.7.2'.
Error: Couldn't install: zope.viewlet 3.7.2

To check, I tried doing the 'easy_install' to a virtualenv set folder.
zope.viewlet package along with its dependencies got installed even
though I got the following error with RestrictedPython-3.6.0 package

Processing RestrictedPython-3.6.0.zip
Running RestrictedPython-3.6.0/setup.py -q bdist_egg
--dist-dir 
/tmp/easy_install-pNkln2/RestrictedPython-3.6.0/egg-dist-tmp-UpguQT
SyntaxError: ('invalid syntax',

('build/bdist.linux-x86_64/egg/RestrictedPython/tests/before_and_after27.py', 
30, 17, 'x = {y: y for y in whatever if y}\n'))

SyntaxError: ('invalid syntax',

('build/bdist.linux-x86_64/egg/RestrictedPython/tests/security_in_syntax27.py', 
6, 13, '{y: y for _restricted_name in x}\n'))

SyntaxError: ('invalid syntax',

('/tmp/test2/lib/python2.6/site-packages/RestrictedPython-3.6.0-py2.6.egg/RestrictedPython/tests/before_and_after27.py',
 30, 17, 'x = {y: y for y in whatever if y}\n'))

SyntaxError: ('invalid syntax',

('/tmp/test2/lib/python2.6/site-packages/RestrictedPython-3.6.0-py2.6.egg/RestrictedPython/tests/security_in_syntax27.py',
 6, 13, '{y: y for _restricted_name in x}\n'))

Adding RestrictedPython 3.6.0 to easy-install.pth file

Installed 
/tmp/test2/lib/python2.6/site-packages/RestrictedPython-3.6.0-py2.6.egg
Finished processing dependencies for zope.viewlet

I googled to find the solution for this but I couldn't find one. Can
someone tell me where I am wrong?

Thanks

-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] [BlueBream] error while installing zope.viewlet via buildout in bluebream

2011-07-11 Thread Joshua Immanuel
Hello Christian,

On Mon, 2011-07-11 at 11:35 +0200, Christian Klinger wrote:
 why you don't add this in setup.py install_requires?
 
 ...
 
install_requires=[..., 'zope.viewlet',...]
 
 ...

As you said, I removed the 'zope.viewlet' line from buildout.cfg and
added it to the 'install_requires' in setup.py. Still I get the same
error. :(

-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] error while installing zope.viewlet via buildout in bluebream

2011-07-11 Thread Joshua Immanuel
Hello,

On Mon, 2011-07-11 at 12:52 +0530, Joshua Immanuel wrote:
 I am finding it hard to install zope.viewlet package via buildout.
 Here is my buildout configuration snippet
 
 [zopeextras]
 recipe = zc.recipe.egg
 eggs = zope.catalog
zope.viewlet
 
 [app]
 recipe = zc.recipe.egg
 eggs = testbb
z3c.evalexception=2.0
Paste
PasteScript
PasteDeploy
${zopeextras:eggs}
 interpreter = bbpy
 
 ...
 
 I get the following error while running buildout
 
 Getting distribution for 'zope.viewlet==3.7.2'.
 install_dir /home/joshua/mudpit/testbb/eggs/tmpv7F8Bd
 error: None
 An error occured when trying to install zope.viewlet 3.7.2.
 Look
 above this message for any errors that were output by
 easy_install.
 While:
   Installing zopeextras.
   Getting distribution for 'zope.viewlet==3.7.2'.
 Error: Couldn't install: zope.viewlet 3.7.2 

In order to simplify things, instead of checking it in bluebream's
buildout config I created a separate buildout.cfg file in an empty
folder with the following configuration

[buildout]
parts = ze

[ze]
recipe = zc.recipe.egg
eggs = zope.viewlet
interpreter = mypy

Still I get the same error. So, I guess this is not just a bluebream
issue.

Can someone tell me where the problem is?

Thanks
-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] [BlueBream] error while installing zope.viewlet via buildout in bluebream [SOLVED]

2011-07-11 Thread Joshua Immanuel
Hello Michael,

On Mon, 2011-07-11 at 13:47 +0200, Michael Howitz wrote:
 Maybe the file in your downloads cache is broken. So delete it and try
 again.

Yes. You were right. Deleting the 'zope.viewlet-3.7.2.tar.gz' from the
buildout cache solved the problem.

Thanks for helping me out even if the problem is too silly.

-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] [BlueBream] Reg. updating catalog indexes in bluebream [SOLVED]

2011-06-27 Thread Joshua Immanuel
Hello all,

On Fri, 2011-06-24 at 15:24 +0530, Joshua Immanuel wrote:
 In setitem function of zope.container.contained
 'notify(ObjectAddedEvent)' happens, this causes the
 'addIntIdSubscriber' adapter of zope.intid to be called. This in turn
 registers the 'Client' object and notifies for 'IntIdAddedEvent'. 
 
 But I don't see the 'indexDocSubscriber' of zope.catalog.catalog which
 is the adapter for 'IIntIdAddedEvent' being called. Why is this so?

I found the source of the problem, zope.catalog package was not a part
of bluebream's default package set. I've manually added that package in
my buildout.cfg but I forgot to include that package in zcml. Including
that package in ZCML solved my problem.

As Thierry said, I didn't write a separate subscriber to update the
catalog indexes.

As Christian said, I overridded the 'create' method of zope.formlib's
AddForm instead of 'createAndAdd method. Moreover in my container's
interface file I added two methods namely 'add' and 'nextURL', and
implemented them. So, I removed the 'allow attributes' tag in zcml for
my container class altogether.

Now everything works out of the box.

Thanks guys for your invaluable inputs.

-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] [BlueBream] Reg. updating catalog indexes in bluebream

2011-06-24 Thread Joshua Immanuel
On Fri, 2011-06-24 at 00:12 +0200, Thierry Florac wrote:
 You don't have to subscribe to IContainerModifiedEvent or
 IObjectModifiedEvent: zope.intid and zope.catalog packages already
 provide subscribers for these events to automatically handle updates
 of indexes.
 
 What you have to do is just to generate an ObjectAddedEvent or
 ObjectModifiedEvent when your object is added or modified, and notify
 subscribers for it:

When I add my object to its container via zope.formlib AddForm's
createAndAdd method like this

cl = Client()
...
self.context[cid] = cl

(P.S: I didn't explicitly notify the ObjectAddedEvent.)

In setitem function of zope.container.contained
'notify(ObjectAddedEvent)' happens, this causes the 'addIntIdSubscriber'
adapter of zope.intid to be called. This in turn registers the 'Client'
object and notifies for 'IntIdAddedEvent'. 

But I don't see the 'indexDocSubscriber' of zope.catalog.catalog which
is the adapter for 'IIntIdAddedEvent' being called. Why is this so?

So, sm['intids'] is getting updated as and when new objects are added
but the catalog indexes are not getting updated. Am I missing something?
Or is there any specific zcml configuration needed for this? 

Please guide me.

-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] [BlueBream] Reg. updating catalog indexes in bluebream

2011-06-24 Thread Joshua Immanuel
Hello
On Fri, 2011-06-24 at 12:17 +0200, Christian Klinger wrote:
 what do you mean with via zope.formlib AddForms's createAndAdd' method.
 
 Do you override this method? If so this is wrong you only have to
 add a create method which get's called before the object is persisted in 
 the container. The createAndAdd method triggers then the catalog.

Oh!! I never knew that. I was following the bluebream documentation at
http://bluebream.zope.org/doc/1.0/tutorial2.html#adding-tickets there
they were overriding the 'createAndAdd' method of AddForm.

Anyways I'll try the 'create' method and get back.

Thanks

-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] [BlueBream] Reg. updating catalog indexes in bluebream

2011-06-24 Thread Joshua Immanuel
Hello,

On Fri, 2011-06-24 at 13:50 +0200, Christian Klinger wrote:
 So if you create in your add form something like this:
 
 class MYAddForm(AddForm):
 
  def create(self, data):
   return MyObject(data)
 
 the catalog stuff is done for you. 

If I override just the 'create' method I get the ForbiddenAttribute for
'add' operation on self.context.add(object) in
zope.formlib.form.AddFormBase.add method. 

Here the 'self.context' is a BTreeContainer whose interface is derived
from IContainer and the ZCML config for that class is marked as 

class class=...
implements
interface=zope.container.interfaces.IContentContainer
/
...
/class

If I add the zcml config for that class to allow attribute like this

...
allow attributes=add /
...

I get AttributeError stating that the object has no attribute 'add'

How do I fix this?

-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] [BlueBream] Reg. updating catalog indexes in bluebream

2011-06-24 Thread Joshua Immanuel
On Fri, 2011-06-24 at 19:13 +0530, Joshua Immanuel wrote:
 If I override just the 'create' method I get the ForbiddenAttribute
 for 'add' operation on self.context.add(object) in
 zope.formlib.form.AddFormBase.add method. 
 
 If I add the zcml config for that class to allow attribute like this
 
 ...
 allow attributes=add /
 ...
 
 I get AttributeError stating that the object has no attribute 'add' 

To fix this if I add a method named 'add' to that container like this

def add(self, object):
self['some_unique_id'] = object

I get a ForbiddenAttribute error for 'nextURL'. 

I guess there is a better way to do this. Please guide me.

-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] [BlueBream] Reg. updating catalog indexes in bluebream

2011-06-24 Thread Joshua Immanuel
Hello Christian,

On Fri, 2011-06-24 at 17:58 +0200, Christian Klinger wrote:
 sorry i have no idea with AttributeErrors. I use grok which has a
 different security policy.

I don't think its a problem related with security policy. Moreover I've
configured zcml to use zope.Public permission everywhere.

Anyways. Thanks for trying to help me.

-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] Reg. updating catalog indexes in bluebream

2011-06-23 Thread Joshua Immanuel
Hello all,

I did the following while adding a new site

sm = site.getSiteManager()

intids = IntIds()
sm['intids'] = intids
sm.registerUtility(intids, IIntIds)

cat = Catalog()
sm['catalog'] = cat
sm.registerUtility(cat, ICatalog)

cat[u'client_name'] = TextIndex('name', IClient)

I ran into the debug shell prompt and checked the length of sm['initid']
after adding 'Client' objects via browser interface. It did reflected
the number of items added. But when I ran a search query in the shell
prompt there were no results

 len(sm['intids'])
4
 list(cat.apply({'client_name': 'xyz*'}))
[]

But when I updated the indexes, it gave out results.

 cat.updateIndexes()
 list(cat.apply({'client_name': 'xyz*'}))
[753759381]

I guess that I don't have to manually update the indexes each time when
an object is added/modified. Am I missing something? 

-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Reg. updating catalog indexes in bluebream

2011-06-23 Thread Joshua Immanuel
Hello all,

Thanks for replying.

On Thu, 2011-06-23 at 17:19 +0200, Charlie Clark wrote:
 The indices do have to be updated every time you add, delete or modify
 an object. This is one of the reasons for the event system you were
 asking  about the other week.

As the size of sm['intids'] were getting incremented as and when new
objects were added, without me doing anything explicitly about it. I was
of the notion that I don't need to explicitly update the indexes. 

If I subscribe for 'IContainerModifiedEvent' for the container of
'Client' object and update the indexes, then I think I'll miss out if
just the attributes of 'Client' object is modified. So, I think along
with this I should subscribe for 'IObjectModifiedEvent' of 'Client'
object. 

Will this be sufficient? Is there any other better way of doing this?

-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] [BlueBream] handling URLs for multiple sites in single bluebream instance

2011-06-18 Thread Joshua Immanuel
Hello all,

On Fri, 2011-06-17 at 21:59 +0530, Joshua Immanuel wrote:
 Ok, let me give an use-case. Say, I have a base page layout template
 for the inner sites like http://localhost:/site1; which has many
 application related menu links on the top and left hand side of the
 page with center space for contents. All these links are of the format
 /container1/ When I use virtual hosting to '/site1' I have no
 problem, all the links will be a valid one, as it will be prefixed by
 http://localhost:/site1;
 
 But, If I don't use virtual hosting and I expose
 http://localhost:/; URL to the user to create new sites. The
 links in base page layout template for the inner sites will be an
 invalid one as it will be pointing to
 http://localhost:/container1/..; instead
 of http://localhost:/site1/container1/..;
 
 I am trying to figure out how to prefix the links in the base page
 layout template with site names based on which site they belong. So
 that the links in the base page layout template of 'site1' would be of
 the format '/site1/container1/.. and the links in base page layout
 template of 'site2' would be of the format '/site2/container1/.. etc.
 
 I guess the solution to this (without virtual hosting) would be: when
 I render the base page layout template for
 http://localhost:/site1; get the 'site1' part from the request
 URL and prefix all the related menu links with them. Is there any
 other better solution?
 
 But, If I use this base page layout template as a macro (just to fill
 its center content with an add form say) still the menu links has to
 be a valid one. How to handle this? 

I used the following code in the base page layout template to get the
site name from the URL 

body tal:define=
rootURL request/getApplicationURL;
fullURL request/getURL;
effURL python: fullURL[len(rootURL)+1:].split('/');

  span tal:condition=python: len(effURL)  1
span tal:define=global urlPrefix python: effURL[0]
  tal:replace=nothing/
  /span

  span tal:condition=python: len(effURL) = 1
span tal:define=global urlPrefix python: ''
  tal:replace=nothing/
  /span
  ...
/body

I prefix all my menu links with the 'urlPrefix' variable. I guess this
is not the best solution but it solves my problem.

Thanks

-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] handling URLs for multiple sites in single bluebream instance

2011-06-17 Thread Joshua Immanuel
Hello all,

In order to serve the same application to multiple clients, I've added
a container named say 'Site' to the root and made them as sites by
site.setSiteManager(LocalSiteManager(site)).  So, the root may contain
many of those 'Site' containers say 'site1', 'site2', etc. and the
application specific objects/containers resides under them.

The application specific URL say /container1/object1/@@add.html would
now become /site1/container1/object1/@@add.html for 'site1' and
/site2/container1/object1/@@add.html for 'site2' etc. depending on
which client (site) is being served. So, how should the URLs be in the
templates? Or in other words, how to handle URLs for multiple clients
(sites) for the same application.

If anyone can explain or point me to some documentation related to this,
it would be very helpful.
-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] [BlueBream] handling URLs for multiple sites in single bluebream instance

2011-06-17 Thread Joshua Immanuel
Hello Thierry,

Thanks for the reply.

On Fri, 2011-06-17 at 14:31 +0200, Thierry Florac wrote:
 I guess you just want to do virtual hosting inside a single BlueBream
 application server 

Ok. That is one way to say. What if I want to add new sites dynamically
from the web frontend?

For the virtual hosting, I don't have to care about the URL prefix, I
just treat my URLs as say, /container1/object1/@@add.html instead of
/site1/container1/object1/@@add.html.

But say, I have a view page for http://localhost:/; (i.e. for
zope.site.interfaces.IRootFolder) which has links to create new sites.
And say, I create necessary application specific objects under them when
the new site is added to the root.

How to dynamically handle the URLs for this kind of situation?

-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] [BlueBream] handling URLs for multiple sites in single bluebream instance

2011-06-17 Thread Joshua Immanuel
Hello,

Sorry to bother again.

On Fri, 2011-06-17 at 16:47 +0200, Thierry Florac wrote:
 Sorry but I'm not really sure to understand what you want or need...
 
 The physical path of your folder inside your ZODB is
 '/site1/container1/...' and to access such a site you only have two
 ways to do it :
  - address it directly in the URL
  - or use virtual hosting to hide '/site1' from the URL

Ok, let me give an use-case. Say, I have a base page layout template for
the inner sites like http://localhost:/site1; which has many
application related menu links on the top and left hand side of the page
with center space for contents. All these links are of the format
/container1/ When I use virtual hosting to '/site1' I have no
problem, all the links will be a valid one, as it will be prefixed by
http://localhost:/site1;

But, If I don't use virtual hosting and I expose
http://localhost:/; URL to the user to create new sites. The links
in base page layout template for the inner sites will be an invalid one
as it will be pointing to http://localhost:/container1/..; instead
of http://localhost:/site1/container1/..;

I am trying to figure out how to prefix the links in the base page
layout template with site names based on which site they belong. So that
the links in the base page layout template of 'site1' would be of the
format '/site1/container1/.. and the links in base page layout template
of 'site2' would be of the format '/site2/container1/.. etc.

I guess the solution to this (without virtual hosting) would be: when I
render the base page layout template for http://localhost:/site1;
get the 'site1' part from the request URL and prefix all the related
menu links with them. Is there any other better solution?

But, If I use this base page layout template as a macro (just to fill
its center content with an add form say) still the menu links has to be
a valid one. How to handle this?

Hope I clarified what I need. Please excuse me if my question sounds too
novice.


-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] [BlueBream] handling URLs for multiple sites in single bluebream instance

2011-06-17 Thread Joshua Immanuel
Hello Thierry,

On Fri, 2011-06-17 at 19:28 +0200, Thierry Florac wrote:
 I suppose that you could write your own IAbsoluteURL adapter ;-)
 Alternatively, for a given context, you can probably try to find it's
 parent site (« site1 », via getParents() traversing method), get
 it's URL and concatenate it with your actual absolute URLs... 

I'll try out and get back. 

Thanks for answering my queries patiently.
-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] [BlueBream] Reg. persisting data in ZODB via forms

2011-06-09 Thread Joshua Immanuel
Hello Jonah,

On Wed, 2011-06-08 at 22:25 -0700, Jonah Crawford wrote:
 Ah yes you do that in the zcml right after you define your object in a
 class :) 

I am not aware of the zcml configuration that can mark a class as
persistent. If you could explain, it would be helpful.

 On Jun 8, 2011, at 10:23 PM, Joshua Immanuel wrote: 
  I was trying to add a non persistent object to the BTreeContainer. I
  was of the notion that I don't need to make my object persistent
  explicitly, as I am adding it to the persistent btree container. The
  add operation was successful but the modify operation on my object
  failed to persist.
  Making my object persistent solved the issue.

I derived my class from persistent.Persistent in order to make it
persistent.

P.S: Do a reply all, as your replies are directed just to me and it
doesn't reach the mailing list.

-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] Reg. persisting data in ZODB via forms

2011-06-08 Thread Joshua Immanuel
Hello all,
I am using zope.formlib.form package for my forms, when overriding the
'createAndAdd' method of form.AddForm I don't explicitly do the
zope.event.notify(ObjectCreatedEvent(..)) call. I just add the data to
self.context and it gets added (persisted) in the ZODB. 

But when I extend the form.EditForm in order to implement my own
Apply action method, just calling the form.applyData or
form.applyChanges doesn't persist the data.
zope.event.notify(ObjectModifiedEvent(..)) call is needed in order to
persist data.

If someone could explain on this or point me to some documentation
relating to this would be very helpful to me.

Thank you

Regards
-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] [BlueBream] Reg. persisting data in ZODB via forms

2011-06-08 Thread Joshua Immanuel
Hello Jonah,

Thanks for the reply.

On Wed, 2011-06-08 at 09:53 -0700, Jonah Crawford wrote:
 Joshua - persistence in zope occurs based on assignment of values. You
 have to explicitly assign the values your form collects to the object
 you're persisting. That object then gets pickled to the ZODB as long
 as there's an assignment to an object in the ZODB. Events have nothing
 to do with it.
 
 Post some code examples if this isn't helpful enough.

I was trying to add a non persistent object to the BTreeContainer. I was
of the notion that I don't need to make my object persistent explicitly,
as I am adding it to the persistent btree container. The add operation
was successful but the modify operation on my object failed to persist.
Making my object persistent solved the issue.

-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in


signature.asc
Description: This is a digitally signed message part
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )