Re: [Zope] Guestbook example app stops working

2008-12-06 Thread Bernard Devlin
I think I've worked out what is happening.  I'm assuming that the index_html
is written in ZPT; when edited TTW via the ZMI the "expand macros when
editing" is checked, so I guess the various TAL features are being removed
(hence it works until it is saved, and after that the dynamic parts are
missing).  I've no idea if there is a way to switch off this expansion by
default.  If there is, I would suggest that Zope is initially installed in
that condition.  As it is currently, I would say the tutorial examples are
quite confusing.  A real newbie would have little idea as to how it could be
that the HTML was being constructed.  I at least have been lurking round
Zope for some time, so I think I've been able to work it out.
bjd

On Sat, Dec 6, 2008 at 7:56 AM, Bernard Devlin <[EMAIL PROTECTED]> wrote:

> Hi, I'm looking at the idea of using Zope again (a lot seems to have
> changed..)  I'm using Zope 2.11.1, and whilst trying to remind myself of the
> basic machinery of Zope, I  imported the Example apps, and started to fiddle
> around with the Guestbook example.   However, after saving the index_html
> object of the Guestbook, Zope would no longer find any entries to display.
> To check it was simply the act of saving index_html that broke the
> Guestbook, I deleted the Examples folder and re-imported it.  With a fresh
> Examples folder Guestbook worked; simply saving it (without even typing in
> the textarea) would break the Guestbook.  On initial import it shows a
> single Guestbook entry by "Amos", but after saving index_html, it reports
> that the Guestbook is empty.  No changes were made to the 'getEntries'
> script, and the Entries folder still has the entry by "Amos".
>
> I can't see any reason why that would be, and hoped someone else could
> explain what the problem is.
>
>
>
>
>
>
>
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How manage error with zsql

2008-12-06 Thread robert rottermann
hi,

I think you should  write in a python script:

try:
  result = context.insert_data.zsql
  msg = 'data inserted'
except ZeroDivisionError:
  msg = 'ZeroDivisionError occured'

return msg

and in your tal you write:

> 
>tal:content="context/MyPythonscript">
>
> 
>

allways try to put logic in a python script. it is *far* easier than writing
complicated tal

robert

Miguel Beltran R. schrieb:
> I tried to insert data using an zsql, insert fine How manage error with
> zsql.
> Before
> 
>
>Data inserted!!!
> 
>Error type:
>Error type:
> 
> 
> 
> 
> Now (All files are ZPT)
> 
> [index_html]
> ...
> 
> 
> ...
> 
> 
> 
> 
> [proyecto_alta.html]
> 
>tal:condition="context/insert_data.zsql"
>tal:content="string: Data inserted!!!">
> 
> 
> 
> 
> [error_insertar]
> error=_['error']
> if error.type==ZeroDivisionError:
> return "Can't divide by zero."
> else:
> return """An error ocurred.
>   Error type: %s
>   Error value: %s""" % (error.type,
>error.value)
> 
> 
> But say
> 
> Tipo  Unauthorized
> Valor You are not allowed to access 'type' in this context
> TraceBack 
> 
> Traceback (innermost last):
> 
> * Module ZPublisher.Publish, line 119, in publish
> * Module ZPublisher.mapply, line 88, in mapply
> * Module ZPublisher.Publish, line 42, in call_object
> * Module Shared.DC.Scripts.Bindings, line 313, in __call__
> * Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec
> * Module Products.PageTemplates.ZopePageTemplate, line 330, in _exec
> * Module Products.PageTemplates.ZopePageTemplate, line 427, in pt_render
> * Module Products.PageTemplates.PageTemplate, line 96, in pt_render
> * Module zope.pagetemplate.pagetemplate, line 115, in pt_render
> * Module zope.tal.talinterpreter, line 271, in __call__
> * Module zope.tal.talinterpreter, line 346, in interpret
> * Module zope.tal.talinterpreter, line 981, in do_onError_tal
> * Module zope.tal.talinterpreter, line 346, in interpret
> * Module zope.tal.talinterpreter, line 745, in do_insertStructure_tal
> * Module Products.PageTemplates.Expressions, line 199, in
>   evaluateStructure
> * Module zope.tales.tales, line 696, in evaluate
>   *URL: /ceed/finanza/proyecto/proyecto_alta.html*
>   *Line 1, Column 0*
>   *Expression: *
>   *Names:*
> 
>   {'container': ,
>'context': ,
>'default': ,
>'here': ,
> 
>'loop': {},
>'nothing': None,
>'options': {'args': ()},
>'repeat':  0x02382828>,
>'request':  URL=http://sic/finanza/proyecto/proyecto_alta.html>,
> 
>'root': ,
>'template':  /ceed/finanza/proyecto/proyecto_alta.html>,
>'traverse_subpath': [],
>'user': }
> 
> * Module zope.tales.expressions, line 217, in __call__
> * Module Products.PageTemplates.Expressions, line 139, in _eval
> * Module Products.PageTemplates.Expressions, line 91, in render
> * Module Products.PageTemplates.ZRPythonExpr, line 79, in call_with_ns
> * Module Shared.DC.Scripts.Bindings, line 327, in
>   __render_with_namespace__
> * Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec
> * Module Products.PythonScripts.PythonScript, line 327, in _exec
> * Module None, line 2, in error_insertar
>   **
>   *Line 2*
> 
> Unauthorized: You are not allowed to access 'type' in this context
> 
> 
> 
> (Example taked from
> http://www.plope.com/Books/2_7Edition/AppendixC.stx#2-28
> )
> 
> 
> -- 
> 
> Lo bueno de vivir un dia mas
> es saber que nos queda un dia menos de vida
> 
> 
> 
> 
> ___
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )

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


Re: [Zope] How manage error with zsql

2008-12-06 Thread Andreas Jung



  **
  *Line 2*

Unauthorized: You are not allowed to access 'type' in this context



I think this is a know issue and be have a bugreport + patch already for 
that within the Launchpad bugtracker. However I cant the ticket number 
right now.


Andreas
begin:vcard
fn:Andreas Jung
n:Jung;Andreas
org:ZOPYX Ltd. & Co. KG
adr;quoted-printable:;;Charlottenstr. 37/1;T=C3=BCbingen;;72070;Germany
email;internet:[EMAIL PROTECTED]
title:CEO
tel;work:+49-7071-793376
tel;fax:+49-7071-7936840
tel;home:+49-7071-793257
x-mozilla-html:FALSE
url:www.zopyx.com
version:2.1
end:vcard

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


[Zope] Multiple zope instances using the same storage

2008-12-06 Thread Mark Gibson
I have an unusual setup.  I have 4 distinct Zope instances (4 seperate 
Data.fs').  Each Data.fs is identical - Data is kept in a RDBMS.  I have 
a product I need to install that stores data in the ZODB.  This data is 
stored in one folder.

Now, I *think* I can simply mount this folder in each ZODB and serve the 
storage through a ZEO server - however I've never done this setup, so I 
want to make sure this makes sense and I'm not overlooking potential 
problems.

This is a legacy setup that I'm not responsible for, so I'm trying to 
keep my footprint in this setup as small as possible.  Using Zope 2.7.9.

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


Re: [Zope] Multiple zope instances using the same storage

2008-12-06 Thread robert rottermann
Mark Gibson schrieb:
> I have an unusual setup.  I have 4 distinct Zope instances (4 seperate 
> Data.fs').  Each Data.fs is identical - Data is kept in a RDBMS.  I have 
> a product I need to install that stores data in the ZODB.  This data is 
> stored in one folder.
> 
> Now, I *think* I can simply mount this folder in each ZODB and serve the 
> storage through a ZEO server - however I've never done this setup, so I 
> want to make sure this makes sense and I'm not overlooking potential 
> problems.
> 
> This is a legacy setup that I'm not responsible for, so I'm trying to 
> keep my footprint in this setup as small as possible.  Using Zope 2.7.9.
> 
> Thanks,
> Mark
this should be possible
there is even a tutorial someplace.
google for mountpoint
or catalog in an extra data.fs
or something such
robert
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How manage error with zsql

2008-12-06 Thread Dieter Maurer
robert rottermann wrote at 2008-12-6 17:15 +0100:
>I think you should  write in a python script:
>
>try:
>  result = context.insert_data.zsql

I expect (at least) two errors here. "context.insert_data()" has
a chance to work.

>  msg = 'data inserted'
>except ZeroDivisionError:
>  msg = 'ZeroDivisionError occured'



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