Re: [Zope] sorting ids in python

2008-12-08 Thread robert rottermann
Andreas Jung schrieb:
> On 08.12.2008 21:11 Uhr, robert rottermann wrote:
>> Garry Saddington schrieb:
>>> Can anyone help me sort the following by id in a python script?
>>>
>>> for object in context.objectValues(['Folder', 'DTML
>>> Document','ZipFolder','File','Image']):
>>
>> objs=context.objectValues(['Folder',
>> 'DTMLDocument','ZipFolder','File','Image'])
>> objs.sort()
>> for o in objs:
>>   ..
> 
> huh? Afaik there is no sort order defined on a per-object basis.wh
I *allways* mixup objecItems with objectValues
so its objecItems(..).sort() ..
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] sorting ids in python

2008-12-08 Thread Andreas Jung

On 08.12.2008 21:11 Uhr, robert rottermann wrote:

Garry Saddington schrieb:

Can anyone help me sort the following by id in a python script?

for object in context.objectValues(['Folder', 'DTML
Document','ZipFolder','File','Image']):


objs=context.objectValues(['Folder', 'DTMLDocument','ZipFolder','File','Image'])
objs.sort()
for o in objs:
  ..


huh? Afaik there is no sort order defined on a per-object basis.

-aj
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 )


Re: [Zope] How manage error with zsql

2008-12-08 Thread Miguel Beltran R.
I trying the next, but not work say " invalid syntax (Script (Python), line
11)"

2008/12/6 robert rottermann <[EMAIL PROTECTED]>

> hi,
>
> I think you should  write in a python script:
>
> try:
>  result = context.insert_data.zsql
>  msg = 'data inserted'
> except StandardError as e: <-- error here
>  msg = 'Error type %s. Value: %s' % (e.type, e.value)
>
> return msg
>
>
If change to


try:
   result=context.proyecto_alta_zsql()
   msg="Se incertaron los datos correctamente"
except StandardError, (e1,e2):
   msg = "Error valor %s y %s" % (e1,e2)
return msg

say
Tipo: Unauthorized
Valor: You are not allowed to access 'a particular str' in this context

(same error with type?)
___
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] sorting ids in python

2008-12-08 Thread robert rottermann
Garry Saddington schrieb:
> Can anyone help me sort the following by id in a python script?
> 
> for object in context.objectValues(['Folder', 'DTML 
> Document','ZipFolder','File','Image']):

objs=context.objectValues(['Folder', 'DTMLDocument','ZipFolder','File','Image'])
objs.sort()
for o in objs:
 ..

robert

> 
> Import of sequence is not authorised in my python scripts, I am presuming 
> (probably wrongly) that sequence is needed for sort.
> Regards
> Garry
> ___
> 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] sorting ids in python

2008-12-08 Thread Andreas Jung

On 08.12.2008 19:23 Uhr, Andreas Jung wrote:

On 08.12.2008 18:18 Uhr, Garry Saddington wrote:

Can anyone help me sort the following by id in a python script?

for object in context.objectValues(['Folder', 'DTML
Document','ZipFolder','File','Image']):




ids = context.objectIds()


Possibly you need

ids = list(context.objectIds())

-aj


ids.sort()
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 )


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

2008-12-08 Thread Mark Gibson
Dieter Maurer wrote:
> Mark Gibson wrote at 2008-12-6 11:22 -0700:
>> 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 should be possible -- though I expect that you can
> use a single "Data.fs", serve it with ZEO and mount it in each of
> your Zope instances. There is little reason to have 4 identical
> "Data.fs" once you have decided to use ZEO anywhere.

Thanks Dieter.  I agree with you.  This isn't my setup, so I would like 
to avoid having too much of an impact on their setup, but I'll bring it 
up with the client.

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] sorting ids in python

2008-12-08 Thread Andreas Jung

On 08.12.2008 18:18 Uhr, Garry Saddington wrote:

Can anyone help me sort the following by id in a python script?

for object in context.objectValues(['Folder', 'DTML
Document','ZipFolder','File','Image']):




ids = context.objectIds()
ids.sort()

-aj
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 )


Re: [Zope] pb with attach file

2008-12-08 Thread Dieter Maurer
[EMAIL PROTECTED] wrote at 2008-12-8 11:43 +0100:
> ...
>Few months ago, I send my problem with attach file with Zope 2.6 and higher.
>How I have no solution, I send again my problem which is described after 
>
>
>Thanks to help me
>
>Frederique
>
>---
>
>I have created a zclass with zfile as basic class.
>With this class, users could, via a web form, send an attached file if
>they want.
>With zope 2.5 (my previous version) if users don't attach a file, there
>is no problem
>with zope 2.10, if there is no file attached, I have an error message :
>'file not specified". It seems that  attach  file is mandatory.
>
>Here, the complete message from the events log :
>
>Traceback (innermost last):
> ...
>   Module ZClasses.ZClass, line 454, in createInObjectManager
>   Module ZClasses.ZClass, line 485, in fromRequest
>   Module ZPublisher.mapply, line 89, in mapply
>   Module OFS.Image, line 120, in __init__
>   Module OFS.Image, line 501, in _read_data
>ValueError: File not specified

I cannot tell you what changed since Zope 2.5 (this is far too long ago).

I can tell you why you get the exception above in modern Zope versions:

  A modern Zope version insists that if the "file" parameter
  to "OFS.Image.File.__init__" is a "FileUpload" object, then
  it must have a non empty filename.

You may be able to use this in your "Quest_susvp_add" method as follows:

  You check whether the uploaded file is "False" (this means "empty
  filename") and in this case replace it in "REQUEST.form" with
  an empty string.

Not sure that it will work, though.


-- 
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 )


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

2008-12-08 Thread Dieter Maurer
Mark Gibson wrote at 2008-12-6 11:22 -0700:
>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 should be possible -- though I expect that you can
use a single "Data.fs", serve it with ZEO and mount it in each of
your Zope instances. There is little reason to have 4 identical
"Data.fs" once you have decided to use ZEO anywhere.



-- 
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 )


[Zope] sorting ids in python

2008-12-08 Thread Garry Saddington
Can anyone help me sort the following by id in a python script?

for object in context.objectValues(['Folder', 'DTML 
Document','ZipFolder','File','Image']):

Import of sequence is not authorised in my python scripts, I am presuming 
(probably wrongly) that sequence is needed for sort.
Regards
Garry
___
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] generic setup&workflow: how to add to binding??

2008-12-08 Thread robert rottermann
thanks Jean-Michel,

Jean-Michel FRANCOIS schrieb:
>  
>   
>
>   
> 
> 
>   
> 
> 
> 
>   
> 
this unfortunately *replaces* the entries in the binding.
I would like to add to the existing ones.

I can do that by running an old fasion install script but would prefere to do it
"rigth".

thanks
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] generic setup&workflow: how to add to binding??

2008-12-08 Thread Jean-Michel FRANCOIS
Yes you can, Plone do it with generic setup.
- Register your profile (take a look at GenericSetup documentation)
- take a look here:
https://svn.plone.org/svn/plone/CMFPlone/tags/3.1.4/profiles/default/ 
(worflows.xml register the workflows, workflows folder contains them)

look like that;

 
  
   
  


  



  


robert rottermann a écrit :
> Hi there,
> I created a workflow product.
> now I would like this workflow *added* to the bindings of the actual workflow
> settings when the product is installed.
>
> so I have something like:
> File (Default)
> chanched to
> File (Default) MyWorklow
>
>
> I this possible?
> If yes how?
>
> thanks
> 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 )
>   

___
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] pb with attach file

2008-12-08 Thread blondelle
Hello,

Few months ago, I send my problem with attach file with Zope 2.6 and higher.
How I have no solution, I send again my problem which is described after 


Thanks to help me

Frederique

---

I have created a zclass with zfile as basic class.
With this class, users could, via a web form, send an attached file if
they want.
With zope 2.5 (my previous version) if users don't attach a file, there
is no problem
with zope 2.10, if there is no file attached, I have an error message :
'file not specified". It seems that  attach  file is mandatory.

Here, the complete message from the events log :

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 OFS.DTMLMethod, line 144, in __call__
- 
- URL: http://assistance.abes.fr/do_add/manage_main
- Physical Path: /assistance/do_add
   Module DocumentTemplate.DT_String, line 476, in __call__
   Module DocumentTemplate.DT_With, line 76, in render
   Module DocumentTemplate.DT_Util, line 196, in eval
- __traceback_info__: _
   Module , line 1, in 
   Module OFS.DTMLMethod, line 137, in __call__
- 
- URL: http://assistance.abes.fr/Quest_susvp_add/manage_main
- Physical Path: /assistance/Quest_susvp_add
   Module DocumentTemplate.DT_String, line 476, in __call__
   Module DocumentTemplate.DT_With, line 61, in render
   Module DocumentTemplate.DT_Util, line 196, in eval
- __traceback_info__: REQUEST
   Module , line 1, in 
   Module ZClasses.ZClass, line 454, in createInObjectManager
   Module ZClasses.ZClass, line 485, in fromRequest
   Module ZPublisher.mapply, line 89, in mapply
   Module OFS.Image, line 120, in __init__
   Module OFS.Image, line 501, in _read_data
ValueError: File not specified



___
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 )