Re: [Zope3-Users] Can interfaces be mutated cleanly?

2007-04-13 Thread Hermann Himmelbauer
Am Donnerstag, 12. April 2007 17:22 schrieb Christian Theune:
 Hi,

 I didn't find anything in the documentation or google on this:

 I want to define an interface like:

 class IMySchema(zope.interface.Interface):
pass

 Later, I want to use ore.alchemist which currently is able to take a
 SQLAlchemy table description and turn it into a new interface/schema.

Interesting - is ore.alchemist the package developed by Kapil Thangalevu? If 
yes, is it working? I had the impression that the project is abandoned.

I currently use z3c.zalchemy, which has, however no automatic generation of 
interfaces.

 I want to extend this code so that I can pass it an existing interface
 to modify it (update) with the schema definition.

 I need this so that the interface is:

 a) present in the code when reading it

 b) available for ZCML configuration (it's a problem for us right now
 because the database/SQLAlchemy stuff is setup up a little bit later
 after executing a couple of ZCML actions)

This is a concept I was also thinking about but I'm unsure if it would really 
lead to architectural advantages:

The DDL statements specify several constraints for the mapped object, such as:

- Data Type
- Maximum string length
- Enumerations (check in)
- not null/with default

So it looks at first appealing to directly adopt them in the object's 
interface. However, there may be two caveeats:

1) Often, the interface definitions are stricter than the DDL-statements. For 
instance, the database could define a varchar(40), while in the interface, 
I'd rather limit the schema (and therefore an input field) to a length of 20. 
Or maybe I'd like to use a more specific datatype which can not be 
automatically deduced from the DDL-statements

2) All ends up with constraints in different locations - some are in the DDL 
statements, others are in the interfaces. So maybe this also leads to 
redundancy and complexity. Moreover, what happens if the DDL and interfaces 
are not being maintained by the same developer group? What if the database 
guys choose to extend some varchar from 40 to 400, a change which possibly 
propagates to the page layout? (longer input widget). 

Therefore maybe it's cleaner to define everything in the interface of the 
mapped object, regardless if this information is redundant. And then I'm 
thinking about some check function that tests if the DDL-statements and the 
interface definitions are conflicting or not - much like with interfaces, 
which only have contracts with objects (via implements()) and provide 
utilities such as verifyObject to check if they comply.

Best Regards,
Hermann 

-- 
[EMAIL PROTECTED]
GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9  4902 64B4 D16B 2998 93C7
___
Zope3-users mailing list
[EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Can interfaces be mutated cleanly?

2007-04-13 Thread Stephan Richter
On Thursday 12 April 2007 11:22, Christian Theune wrote:
 While looking into it, we found that interfaces do not offer a public
 way to modify the attributes they have, and modifying the internal data
 structures would be both evil and cumbersome.

It is a violation of the interface contract that they can be modified.

 Any hints?

However, work in this area has been done with persistent schema. Look for 
zope.app.schema; if it is deleted from the repos, look in older revisions.

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
[EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] ZEO security examples

2007-04-13 Thread Thierry Florac

  Hi,

Maybe I'm wrong, but it seems that ZEO protocol is, by default,
unauthenticated.
I've read here and there a few references to an authentication mechanism
which could be setup in ZOPE/ZEO, but can't find any valuable
implementation example for Zope3.
So, any link to define this for Zope3 would be very nice.

Thanks for any help,

  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
[EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] ZEO security examples

2007-04-13 Thread David Pratt
Hi Thierry. There is a basic means of authentication built in to ZEO but 
it is not terribly secure. You can read about it in the zeo source. You 
may wish to look as Fred's zc.sshtunnel package to help you secure your 
communication.


Regards,
David

Thierry Florac wrote:

  Hi,

Maybe I'm wrong, but it seems that ZEO protocol is, by default,
unauthenticated.
I've read here and there a few references to an authentication mechanism
which could be setup in ZOPE/ZEO, but can't find any valuable
implementation example for Zope3.
So, any link to define this for Zope3 would be very nice.

Thanks for any help,

  Thierry Florac

___
Zope3-users mailing list
[EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Can interfaces be mutated cleanly?

2007-04-13 Thread Kapil Thangavelu


i would suggest some alternatives approaches to consider first.

potentially this would be easier going the other way around with zs2sa,  
and generating the mapper from there, you don't need to annotations as  
well since the zope schemas contain the relevant ui metadata, and the  
schema is the canonical definition of the rdb/sa schema. bonus is you get  
multidb support for the schema, as an example of doing things this way,  
https://svn.objectrealms.net/view/public/browser/ore.member/trunk/src/ore/member/example2.py


the transmute funcction has the options of specifying base interfaes, so  
you also have the option at the risk of ordering dependencies of replacing  
the iface class thats a base arg to the transmute function with the result  
of the transmute function, presumably though if this being done in the  
same module (interfaces.py) then its not an issue though.


cheers,

kapil

On Thu, 12 Apr 2007 11:22:06 -0400, Christian Theune [EMAIL PROTECTED] wrote:


Hi,

I didn't find anything in the documentation or google on this:

I want to define an interface like:

class IMySchema(zope.interface.Interface):
   pass

Later, I want to use ore.alchemist which currently is able to take a
SQLAlchemy table description and turn it into a new interface/schema.

I want to extend this code so that I can pass it an existing interface
to modify it (update) with the schema definition.

I need this so that the interface is:

a) present in the code when reading it

b) available for ZCML configuration (it's a problem for us right now
because the database/SQLAlchemy stuff is setup up a little bit later
after executing a couple of ZCML actions)

While looking into it, we found that interfaces do not offer a public
way to modify the attributes they have, and modifying the internal data
structures would be both evil and cumbersome.

Any hints?

Christian




___
Zope3-users mailing list
[EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Can interfaces be mutated cleanly?

2007-04-13 Thread Kapil Thangavelu
On Fri, 13 Apr 2007 02:36:07 -0400, Hermann Himmelbauer [EMAIL PROTECTED]  
wrote:



Am Donnerstag, 12. April 2007 17:22 schrieb Christian Theune:

Hi,

I didn't find anything in the documentation or google on this:

I want to define an interface like:

class IMySchema(zope.interface.Interface):
   pass

Later, I want to use ore.alchemist which currently is able to take a
SQLAlchemy table description and turn it into a new interface/schema.


Interesting - is ore.alchemist the package developed by Kapil  
Thangalevu? If

yes, is it working? I had the impression that the project is abandoned.


it is, and its working, its been in production since inception, has a  
number of features not present in the other sa zope integrations (schema  
generation, both from sa and from zope.schema, as well keyreference  
support, etc). unfortunately suffers a bit in that the formlib integration  
is currently targetting zope2/plone, but thats contained in a separate z2  
product, as well as my own lack of time to promote it or work on new  
feature developmen at the moment.


cheers,

kapil




___
Zope3-users mailing list
[EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Can interfaces be mutated cleanly?

2007-04-13 Thread Hermann Himmelbauer
Am Freitag, 13. April 2007 20:27 schrieb Kapil Thangavelu:
 i would suggest some alternatives approaches to consider first.

 potentially this would be easier going the other way around with zs2sa,
 and generating the mapper from there, you don't need to annotations as
 well since the zope schemas contain the relevant ui metadata, and the
 schema is the canonical definition of the rdb/sa schema. bonus is you get
 multidb support for the schema, as an example of doing things this way,
 https://svn.objectrealms.net/view/public/browser/ore.member/trunk/src/ore/m
ember/example2.py

 the transmute funcction has the options of specifying base interfaes, so
 you also have the option at the risk of ordering dependencies of replacing
 the iface class thats a base arg to the transmute function with the result
 of the transmute function, presumably though if this being done in the
 same module (interfaces.py) then its not an issue though.

Interesting approach, however, I doubt this is going to work when one has to 
access an existing relational database - like in my case. After all one has 
once again redundant definitions. 

Therefore in cases where the database is designed together with the Zope3 
application, the transmute function could be an interesting approach, but in 
cases where the DDL-statements already exist, the generation of schemas out 
of the table definitions seem to be the better way.

Moreover I'm also curious if advanced table definitions such as constraints, 
checks and the like can be generated from Zope schemas.

Best regards,
Hermann

-- 
[EMAIL PROTECTED]
GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9  4902 64B4 D16B 2998 93C7
___
Zope3-users mailing list
[EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Can interfaces be mutated cleanly?

2007-04-13 Thread Hermann Himmelbauer
Am Freitag, 13. April 2007 20:33 schrieb Kapil Thangavelu:
 On Fri, 13 Apr 2007 02:36:07 -0400, Hermann Himmelbauer [EMAIL PROTECTED]

 wrote:
  Am Donnerstag, 12. April 2007 17:22 schrieb Christian Theune:
  Hi,
 
  I didn't find anything in the documentation or google on this:
 
  I want to define an interface like:
 
  class IMySchema(zope.interface.Interface):
 pass
 
  Later, I want to use ore.alchemist which currently is able to take a
  SQLAlchemy table description and turn it into a new interface/schema.
 
  Interesting - is ore.alchemist the package developed by Kapil
  Thangalevu? If
  yes, is it working? I had the impression that the project is abandoned.

 it is, and its working, its been in production since inception, has a
 number of features not present in the other sa zope integrations (schema
 generation, both from sa and from zope.schema, as well keyreference
 support, etc). unfortunately suffers a bit in that the formlib integration
 is currently targetting zope2/plone, but thats contained in a separate z2
 product, as well as my own lack of time to promote it or work on new
 feature developmen at the moment.

Formlib integration is still something I'm struggling with. I'm currently 
setting up forms (filling with data) manually via SetUpWidgets. Hopefully I 
will be able to break this down on a common denominator, refactor it and 
provide some ORMFormlib library which inherits from form.Form, we'll see...

Best Regards,
Hermann

-- 
[EMAIL PROTECTED]
GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9  4902 64B4 D16B 2998 93C7
___
Zope3-users mailing list
[EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Can interfaces be mutated cleanly?

2007-04-13 Thread Kapil Thangavelu
On Fri, 13 Apr 2007 15:09:29 -0400, Hermann Himmelbauer [EMAIL PROTECTED]  
wrote:



Am Freitag, 13. April 2007 20:27 schrieb Kapil Thangavelu:

i would suggest some alternatives approaches to consider first.

potentially this would be easier going the other way around with zs2sa,
and generating the mapper from there, you don't need to annotations as
well since the zope schemas contain the relevant ui metadata, and the
schema is the canonical definition of the rdb/sa schema. bonus is you  
get

multidb support for the schema, as an example of doing things this way,
https://svn.objectrealms.net/view/public/browser/ore.member/trunk/src/ore/m
ember/example2.py

the transmute funcction has the options of specifying base interfaes, so
you also have the option at the risk of ordering dependencies of  
replacing
the iface class thats a base arg to the transmute function with the  
result

of the transmute function, presumably though if this being done in the
same module (interfaces.py) then its not an issue though.


Interesting approach, however, I doubt this is going to work when one  
has to
access an existing relational database - like in my case. After all one  
has

once again redundant definitions.

Therefore in cases where the database is designed together with the Zope3
application, the transmute function could be an interesting approach,  
but in
cases where the DDL-statements already exist, the generation of schemas  
out

of the table definitions seem to be the better way.

Moreover I'm also curious if advanced table definitions such as  
constraints,

checks and the like can be generated from Zope schemas.


ore.alchemist supports both notions, as both options are wanted for  
different use cases, ie both database as canonical schema representation  
and interfaces as canonical with automatic generation of the other form.  
it does support basic constraint inferment and generation from either  
canonical source. the solution above was presented here in the context of  
a particular deployment.


cheers,

kapil

___
Zope3-users mailing list
[EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Can interfaces be mutated cleanly?

2007-04-13 Thread Kapil Thangavelu
On Fri, 13 Apr 2007 15:13:58 -0400, Hermann Himmelbauer [EMAIL PROTECTED]  
wrote:



Am Freitag, 13. April 2007 20:33 schrieb Kapil Thangavelu:

On Fri, 13 Apr 2007 02:36:07 -0400, Hermann Himmelbauer [EMAIL PROTECTED]

wrote:
 Am Donnerstag, 12. April 2007 17:22 schrieb Christian Theune:
 Hi,

 I didn't find anything in the documentation or google on this:

 I want to define an interface like:

 class IMySchema(zope.interface.Interface):
pass

 Later, I want to use ore.alchemist which currently is able to take a
 SQLAlchemy table description and turn it into a new interface/schema.

 Interesting - is ore.alchemist the package developed by Kapil
 Thangalevu? If
 yes, is it working? I had the impression that the project is  
abandoned.


it is, and its working, its been in production since inception, has a
number of features not present in the other sa zope integrations (schema
generation, both from sa and from zope.schema, as well keyreference
support, etc). unfortunately suffers a bit in that the formlib  
integration
is currently targetting zope2/plone, but thats contained in a separate  
z2

product, as well as my own lack of time to promote it or work on new
feature developmen at the moment.


Formlib integration is still something I'm struggling with. I'm currently
setting up forms (filling with data) manually via SetUpWidgets.  
Hopefully I

will be able to break this down on a common denominator, refactor it and
provide some ORMFormlib library which inherits from form.Form, we'll  
see...




there are lots of rabbit holes here i found, esp. as regards object widget  
usage for embedded relations. i got the feeling that i was one of the few  
people using it.. it doesn't have a display mode, and always seeks to  
create a new object instead of updating in place were the primary issues.  
the rest of the widgets work fairly well out of the box.


-kapil


___
Zope3-users mailing list
[EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope3-users