[Zope3-Users] z3c.formdemo, problems with lxml

2007-08-09 Thread Andreas Reuleaux
I am just following the very simple instructions to
install z3c.formdemo from zc.buildout


$ svn co svn://svn.zope.org/repos/main/z3c.formdemo/trunk formdemo
$ cd formdemo
$ python bootstrap.py
$ ./bin/buildout -v

...lot's of eggs are downloaded, 
but when it comes to the lxml egg, I get tons of errors
- only the last lines shown below - any hints?

-Andreas

...
src/lxml/etree.c:50771: error: ��struct 
__pyx_vtabstruct_5etree__FileParserContext�� has no member named 
��_createParserInput��
src/lxml/etree.c:50771: error: 
��__pyx_f_5etree_18_FileParserContext__createParserInput�� undeclared (first 
use in this function)
src/lxml/etree.c:50772: error: ��struct 
__pyx_vtabstruct_5etree__FileParserContext�� has no member named ��_readDoc��
src/lxml/etree.c:50772: error: ��__pyx_f_5etree_18_FileParserContext__readDoc�� 
undeclared (first use in this function)
src/lxml/etree.c:50773: error: ��struct 
__pyx_vtabstruct_5etree__FileParserContext�� has no member named ��_readDtd?�
src/lxml/etree.c:50773: error: ��__pyx_f_5etree_18_FileParserContext__readDtd�� 
undeclared (first use in this function)
src/lxml/etree.c:50774: error: ��struct 
__pyx_vtabstruct_5etree__FileParserContext�� has no member named 
��copyToBuffer��
src/lxml/etree.c:50802: error: ��struct 
__pyx_vtabstruct_5etree__FilelikeWriter�� has no member named 
��_createOutputBuffer��
src/lxml/etree.c:50802: error: 
��__pyx_f_5etree_15_FilelikeWriter__createOutputBuffer�� undeclared (first use 
in this function)
src/lxml/etree.c:50803: error: ��struct 
__pyx_vtabstruct_5etree__FilelikeWriter�� has no member named ��write��
src/lxml/etree.c:50804: error: ��struct 
__pyx_vtabstruct_5etree__FilelikeWriter�� has no member named ��close��
src/lxml/etree.c:51287: error: ��xmlParserVersion�� undeclared (first use in 
this function)
src/lxml/etree.c:51351: error: ��LIBXML_VERSION�� undeclared (first use in this 
function)
src/lxml/etree.c:51855: error: ��__pyx_v_5etree___DEFAULT_ENTITY_LOADER�� 
undeclared (first use in this function)
src/lxml/etree.c:51858: error: ��__pyx_f_5etree__local_resolver�� undeclared 
(first use in this function)
src/lxml/etree.c:51876: error: ��XML_PARSE_NOENT�� undeclared (first use in 
this function)
src/lxml/etree.c:51876: error: ��XML_PARSE_NOCDATA�� undeclared (first use in 
this function)
src/lxml/etree.c:51876: error: invalid operands to binary |
src/lxml/etree.c:51876: error: invalid operands to binary |
src/lxml/etree.c:52227: error: ��LIBXSLT_VERSION�� undeclared (first use in 
this function)
src/lxml/etree.c:52232: error: ��xsltLibxsltVersion�� undeclared (first use in 
this function)
src/lxml/etree.c:52237: error: ��__pyx_v_5etree_XSLT_DOC_DEFAULT_LOADER�� 
undeclared (first use in this function)
src/lxml/etree.c:52237: error: ��xsltDocDefaultLoader�� undeclared (first use 
in this function)
src/lxml/etree.c:52240: error: ��__pyx_f_5etree__xslt_doc_loader�� undeclared 
(first use in this function)
error: Setup script exited with error: command 'gcc' failed with exit status 1
An error occured when trying to install lxml 1.3.3.Look above this message for 
any errors thatwere output by easy_install.
While:
  Installing test.
  Getting distribution for 'lxml'.
Error: Couldn't install: lxml 1.3.3
[EMAIL PROTECTED](~/tmp/formdemo)$
___
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 Adam Groszer
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[2]: [Zope3-Users] possible bug in zope\app\authentication\principalfolder.py

2007-08-09 Thread Adam Groszer
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


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


Re: [Zope3-Users] z3c.formdemo, problems with lxml

2007-08-09 Thread Darryl Cousins
Hi Andreas,

On Thu, 2007-08-09 at 10:12 +0200, Andreas Reuleaux wrote:
 I am just following the very simple instructions to
 install z3c.formdemo from zc.buildout
 

snip

On Debian this may work:

apt-get libxml2-dev libxslt-dev

Hope that helps.
Darryl



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


[Zope3-Users] Re: z3c.formdemo, problems with lxml

2007-08-09 Thread Philipp von Weitershausen

Darryl Cousins wrote:

Hi Andreas,

On Thu, 2007-08-09 at 10:12 +0200, Andreas Reuleaux wrote:

I am just following the very simple instructions to
install z3c.formdemo from zc.buildout



snip

On Debian this may work:

apt-get libxml2-dev libxslt-dev


In short, Andreas is missing the libxml2 and libxslt headers.


--
http://worldcookery.com -- Professional Zope documentation and training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Strange ZODB error

2007-08-09 Thread Gary Poster
You probably need to find out what the object is for anyone to have a  
chance of helping.


I usually just put a pdb in the ZODB that is triggered if there's an  
error here, and then start poking around.  Using the postmortem debug  
publisher might work too, but it has caused enough problems for me in  
the past that I dropped it, myself.


Gary

On Aug 9, 2007, at 9:44 AM, Hermann Himmelbauer wrote:


Hi,
After updating some z3c packages and changing some of my code, I  
receive a

very strange traceback from Zope3:

--
Traceback (most recent call last):
  File /local/home/dusty/Zope-3.4.0b1/lib/python/zope/publisher/ 
publish.py,

line 138, in publish
publication.afterCall(request, obj)

File /local/home/dusty/Zope-3.4.0b1/lib/python/zope/app/ 
publication/browser.py,

line 78, in afterCall
super(BrowserPublication, self).afterCall(request, ob)

File /local/home/dusty/Zope-3.4.0b1/lib/python/zope/app/ 
publication/zopepublication.py,

line 175, in afterCall
txn.commit()

File /local/home/dusty/Zope-3.4.0b1/lib/python/transaction/ 
_transaction.py,

line 325, in commit
self._commitResources()

File /local/home/dusty/Zope-3.4.0b1/lib/python/transaction/ 
_transaction.py,

line 424, in _commitResources
rm.commit(self)
  File /local/home/dusty/Zope-3.4.0b1/lib/python/ZODB/ 
Connection.py, line

524, in commit
self._commit(transaction)
  File /local/home/dusty/Zope-3.4.0b1/lib/python/ZODB/ 
Connection.py, line

569, in _commit
self._store_objects(ObjectWriter(obj), transaction)
  File /local/home/dusty/Zope-3.4.0b1/lib/python/ZODB/ 
Connection.py, line

596, in _store_objects
p = writer.serialize(obj)  # This calls __getstate__ of obj
  File /local/home/dusty/Zope-3.4.0b1/lib/python/ZODB/ 
serialize.py, line

407, in serialize
return self._dump(meta, obj.__getstate__())
  File /local/home/dusty/Zope-3.4.0b1/lib/python/ZODB/ 
serialize.py, line

416, in _dump
self._p.dump(state)
  File copy_reg.py, line 69, in _reduce_ex
raise TypeError, can't pickle %s objects % base.__name__
TypeError: can't pickle file objects
--

I ran all tests of additional z3c/zc packages, all went well, so it  
seems
there's something wrong in my code, however I don't see where. I  
don't use

any file objects, so I'm clueless...

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
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] Strange ZODB error - Solved: Zalchemy bug

2007-08-09 Thread Hermann Himmelbauer
Am Donnerstag, 9. August 2007 15:44 schrieb Hermann Himmelbauer:
 Hi,
 After updating some z3c packages and changing some of my code, I receive a
 very strange traceback from Zope3:

Ah, after fiddling around I found out that the svn update of the zalchemy 
package resulted in this error. If somewhere in my code zalchemy is used, the 
TypeError emerges. It seems that recently there was a change to the zalchemy 
package (svn log):


r78682 | zagy | 2007-08-08 10:53:01 +0200 (Mi, 08 Aug 2007) | 1 line

using the threadlocal strategy of sqlalchemy instead of creating one engine 
per
thread. This allows connection pooling for instance.


I reverted zalchemy to an older version an all is well again.

Once again it proves that updating only makes sense if an update is really 
necessary... ;-)

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
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] z3c.form: How to hide a button/define action without a button?

2007-08-09 Thread Hermann Himmelbauer
Am Donnerstag, 9. August 2007 04:08 schrieb Stephan Richter:
 On Monday 06 August 2007 10:41, Hermann Himmelbauer wrote:
  Is there a way simple way to accomplish this? Perhaps via a hidden=True
    attribute in the buttonAndHandler decorator method?

 I would override the ``updateActions()`` method in the form as follows:

 def updateActions(self):
   super(MyForm, self).updateActions()
   self.actions['store'].addClass('hidden')

 Then have a style:

 input.hidden {
   display: None;
 }

Great idea! This works out nicely! Thanks!

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
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


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

2007-08-09 Thread Stephan Richter
On Wednesday 08 August 2007 12:14, Shailesh Kumar wrote:
 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).

You are right. The interface says it is a text line, thus accepting unicode. 
So this is a bug.

 Is this intentional???

Can you file a bug report or even fix it yourself, including a test?

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


Re: [Zope3-Users] Using zope.formlib for a search form

2007-08-09 Thread Stephan Richter
On Thursday 09 August 2007 22:14, Andrew Groom wrote:
 I've been battling with formlib for the last three days now and, while
 I've learnt a lot, it's nearly driven me crazy. I'm trying to use it to
 create simple search form, i.e., a form that does input validation,
 remembers the values you entered, etc., but is not tied to a persisted
 object.

 I've got the form rendering and processing requests, but I'm completely
 stuck on getting the form to remember the values I just entered after a
 form post.

 Has anyone got any suggestions ? Here's what I've got so far, the latest
 attempt being to use a dummy object to provide the context, which also
 doesn't seem to work:

Unfortunately, I cannot help you here, since I have been using z3c.form 
recently (of course). z3c.form is better documented and provides the hooks I 
think you are looking for here. For example, the context for the form -- 
called content within z3c.form -- can be overwritten by implementing a custom 
``getContent()`` method. If you do that, you can store your info in a session 
for example.

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] Using zope.formlib for a search form

2007-08-09 Thread Andrew Groom

Hi All,

I've been battling with formlib for the last three days now and, while 
I've learnt a lot, it's nearly driven me crazy. I'm trying to use it to 
create simple search form, i.e., a form that does input validation, 
remembers the values you entered, etc., but is not tied to a persisted 
object.


I've got the form rendering and processing requests, but I'm completely 
stuck on getting the form to remember the values I just entered after a 
form post.


Has anyone got any suggestions ? Here's what I've got so far, the latest 
attempt being to use a dummy object to provide the context, which also 
doesn't seem to work:


#--
# Classes for bulding the search form
#--
class UserSearchForm (Form):

# Vocab for boolean items
bool_vocab = SimpleVocabulary.fromItems([('Any', ''), ('Yes', 
'true'), ('No', 'false')])


# Form fields
form_fields = Fields(Choice( __name__='is_verified',
   vocabulary=bool_vocab,
  title=uIs verified?,
  description=uHas the users email address 
been verified ?),

   Choice( __name__='is_opted_in',
   vocabulary=bool_vocab,
  title=uHas opted in for emails,
  description=uHas the user opted in for 
emails ?),

   Choice( __name__='is_old_extension_user',
   vocabulary=bool_vocab,
  title=uIs not using the latest extension,
  description=uIs the user using the 
latest extension ?),

   Choice( __name__='is_extension_user',
   vocabulary=bool_vocab,
  title=uIs an extension user,
  description=uIs the user using the 
extension ?),

   )

# Vocab for email templates
templates = EmailTemplates()
template_vocab = SimpleVocabulary.fromItems(templates.get_tuples())

form_fields += Fields(Choice( __name__='template',
   vocabulary=template_vocab,
  title=uEmail template?,
  readonly=True,
  description=uChoose an email template ? ),
   )

prefix = 'search'
label = 'Search for Users'
template = ViewPageTemplateFile('templates/searchform.pt')

actions = form.Actions(
   form.Action('search', success='process_search'),
   form.Action('process', 
success='process_action'),

   )

_results = None


#--
# Dummy search form context object
#--
class UserSearchFormData:

def __init__ (self):
self.is_old_extension_user = True
self.is_extension_user = False
self.is_verified = True
self.is_opted_in = False


#--
# Classes for registering the search form as a content provider
#--
class UserSearchFormProvider:
implements(IContentProvider)
adapts(Interface, IDefaultBrowserLayer, Interface)

def __init__(self, context, request, view):
self.context = context
self.request = request
self.__parent__ = view
self.obj = UserSearchFormData()
self.form = UserSearchForm(self.obj, self.request)

def update(self):
pass

def render(self):
import pdb; pdb.set_trace()
return self.form()

#--
# User admin view
#--
class UserAdminView (BrowserView):

def __init__ (self, context, request):
self.context = context
self.request = request

# Set up the form content provider
provideAdapter(UserSearchFormProvider, 
name=vortexuser.UserSearchFormProvider)



Many thanks for any help.

Cheers, Andrew.
---
Reurbanise - Urban Sustainability
ph: (03) 3528 055, mobile: 0274 992 569
http://www.reurbanise.co.nz
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] principal associated data in a form

2007-08-09 Thread Stephan Richter
On Tuesday 24 July 2007 12:30, Otto van der Meer wrote:
 The idea is that many residents of a house have a single user account
 (nature of app).
 and that the names of the residents are associated with the account so
 they can be used in the application.

 Therefor the house would be the Principal I think, but what to do with the
 names of the
 residents, put them in the principal metadata or as an attribute of
 Principal?

The way you attach information on a principal is to use principal annotations. 
BTW, the homefoler implementation 
(http://svn.zope.org/zope.app.homefolder/trunk/) is a great example of how to 
associate additional information with a principal.

 To use the names in the form (As a choice), i've learned they have to be
 in vocabulary,
 but how do I get these names in the vocubulary after the Principal is
 authenticted?

You probably want to store the resident names in the principal annotation and 
then create a vocabulary that uses the principal annotation to build terms.

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


Re: [Zope3-Users] principal associated data in a form

2007-08-09 Thread Fred Drake
On 7/24/07, Otto van der Meer [EMAIL PROTECTED] wrote:
 The idea is that many residents of a house have a single user account
 (nature of app).
 and that the names of the residents are associated with the account so
 they can be used in the application.

I guess it depends on what you mean by user account.  One approach
(apparently not the first folks think of) would be to use a separate
principal for each resident, and all residents would be associated
with a single shared account.

It really depends on what the account represents (billing, perhaps),
and whether it really mattered if you could really tell the residents
apart for an account, or if the honor system is good enough.


  -Fred

-- 
Fred L. Drake, Jr.fdrake at gmail.com
Chaos is the score upon which reality is written. --Henry Miller
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Cache values must be persistent objects. - ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg

2007-08-09 Thread Andreas Reuleaux
The example below (contacts) works fine for me with a recent svn
checkout of the 3.4 branch, i e
  
svn co svn://svn.zope.org/repos/main/Zope3/branches/3.4 z3

but I get errors with a recent eggs installation via zc.buildout
(when trying to edit and save a contact, see below)

...
File 
/home/reuleaux/z3eggs/tmp17mUe4/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/Connection.py,
 line 58
3, in _commit
  File 
/home/reuleaux/z3eggs/tmp17mUe4/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/Connection.py,
 line 63
5, in _store_objects
TypeError: Cache values must be persistent objects.


It seems other people where having similar troubles, see e. g.
  http://www.nabble.com/Problems-with-ZODB3-3.9.0_dev_r77011-t4109664.html
however it is not obvious to me how to exactly apply the solutions proposed
there to my code - there is no external file (like an image) involved in
my code.

The example is not to long, however it is not trivial:
uses formlib, an object in its schema, 
object widgets, object widget dispatcher etc.
- I have therefore included the complete example. -
for convenience: I have also put it online (my old university account)

  $ wget -nd http://user.cs.tu-berlin.de/~reuleaux/contacts.tgz
  $ tar xvpzf contacts.tgz
  $ cd contacts

  edit buildout.cfg as you see fit, you might for example change 
  the eggs-directory
  maybe adjust the mngr user/passwd in src/contacts/app.zcml  

  $ python bootstrap
  $ ./bin/buildout
  $ ./bin/instance start

usage / steps to reproduce:

  go to http://localhost:8080

  log in as mngr and add some contacts - that works fine
  
  now edit such a contact (say I have given it a name rx)
  http://localhost:8080/rx/edit
  and try to save it: boom!

I am aware that object widgets are kind of superseeded with
the advent of z3c.form - and I really want to go in that direction
but for the time being my programming would be much more relaxed
if I got this example working,

I could really need a helping hand here, thanks.

-Andreas



interfaces.py

from zope.interface import Interface
from zope.schema import TextLine, Object



class IAddr(Interface):
an address.


street = TextLine(
title=ustreet,
description=uthe street,
required=False,
missing_value=u''
)

city = TextLine(
title=ucity,
description=uthe city,
required=False,
missing_value=u''
)


zipcode = TextLine(
title=uzip,
description=uthe zip code,
required=False,
missing_value=u''
)



class IContact(Interface):
a contact


name = TextLine(
title=uname,
description=uthe name,
required=False,
missing_value=u''
)


firstname = TextLine(
title=ufirstname,
description=uthe firstname,
required=False,
missing_value=u''
)


addr=Object(
title=u'address',
description=u'the address',
required = False,
schema=IAddr)



addr.py

from zope.interface import implements
from interfaces import IAddr
from zope.schema.fieldproperty import FieldProperty
from persistent import Persistent


class Addr(Persistent):
Eine Addr.

implements(IAddr)

street = FieldProperty(IAddr['street'])
city = FieldProperty(IAddr['city'])
zipcode = FieldProperty(IAddr['zipcode'])

def __init__(self,
 street=u'',
 city=u'',
 zipcode=u'',
 titel=u'',
 geb=u'',
 fkt=u''):
self.street=street
self.city=city
self.zipcode=zipcode



contact.py


from zope.interface import implements
from interfaces import IContact
from zope.schema.fieldproperty import FieldProperty
from persistent import Persistent
from zope.security.proxy import removeSecurityProxy


# from zope.app.container.contained import Contained

# class Contact(Contained, Persistent):
class Contact(Persistent):
a contact.

implements(IContact)

__name__ = __parent__ = None

name = FieldProperty(IContact['name'])
firstname=FieldProperty(IContact['firstname'])
addr = FieldProperty(IContact['addr'])

def __init__(self,
 name=u'',
 firstname=u'',
 addr=None,
 ):
self.name=name
self.firstname=firstname
self.addr=addr


# def __getstate__(self):
#   s=Persistent.__getstate__(self)
#s['addr']=removeSecurityProxy(self.addr)
#return s
  


views.py

from zope.formlib import form, namedtemplate
from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
from interfaces import IContact
from contact import 

[Zope3-Users] Re: Strange ZODB error - Solved: Zalchemy bug

2007-08-09 Thread Christian Zagrodnick
On 2007-08-09 16:27:23 +0200, Hermann Himmelbauer 
[EMAIL PROTECTED] said:



Am Donnerstag, 9. August 2007 15:44 schrieb Hermann Himmelbauer:

Hi,
After updating some z3c packages and changing some of my code, I receive a
very strange traceback from Zope3:


Ah, after fiddling around I found out that the svn update of the 
zalchemy package resulted in this error. If somewhere in my code 
zalchemy is used, the TypeError emerges. It seems that recently there 
was a change to the zalchemy package (svn log):



r78682 | zagy | 2007-08-08 10:53:01 +0200 (Mi, 08 Aug 2007) | 1 line

using the threadlocal strategy of sqlalchemy instead of creating one engine per
thread. This allows connection pooling for instance.


I reverted zalchemy to an older version an all is well again.


Interesting. I wonder why this happens. I'll try to reproduce.


--
Christian Zagrodnick

gocept gmbh  co. kg  ·  forsterstrasse 29 · 06112 halle/saale
www.gocept.com · fon. +49 345 12298894 · fax. +49 345 12298891



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