[Zope3-Users] IEndRequestEvent question

2006-06-05 Thread Thierry FLORAC





  Hi,

I'd like to ask several questions about "IEndRequestEvent", like :
 - when is this event actually fired ?
 - what can be done exactly after this event is fired (still query components, update database...) ?
 - if possible, are modifications done after this event integrated into the main transaction ?

My goal is to use request annotations to reference several objects that should be treated after the main request process is done, and then to subscribe to this event to fire these final modifications (so that, for example, "IObjectModifiedEvent" is not fired too many times). Is it the good approach ?

Thanks for any help,
Thierry


-- 
This message has been scanned for viruses and
dangerous content by
MailScanner, and is
believed to be clean.

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


Re: [Zope3-Users] Time Zones/Internationalization

2006-06-05 Thread David Johnson
That's great! That does seem to figure that out.  The secrets of Zope.

On Mon, 2006-06-05 at 18:53 -0300, David Pratt wrote:
> Hi David. pytz is a standard python package included in zope that can 
> help you manage time zone issues. There are methods to represent time 
> that is properly offset according to a large database of global 
> timezones. This will help you present the view of time you wish to your 
> application's users. Refer to the documentation in the package to give 
> you an idea of what is possible.
> 
> Regards,
> David
> 
> David Johnson wrote:
> > How do you deal with time zones in your applications, in regards to
> > dates and times entered by users of the application. 
> > 
> > For example consider a content object that represents a store, and
> > includes the store hours.  A store owner may enter their opening ours as
> > 0800 in their timezone.  Do you store this as 0800? How does locale fit
> > in both in terms of store owners and store customers (who may be in
> > different time zones)?
> > 
> > 
> > 
> > 
> > ___
> > 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] Custom index implementation

2006-06-05 Thread Tom Dossis
Achim Domma wrote:
> Hi,
> 
> I try to implement a custom index to be inserted into a catalog. I look
> at the code and it seems to me, that I only have to derive my interface
> from ICatalogIndex. I have defined my interface like this:
> 
> class ITestIndex(zope.app.catalog.interfaces.ICatalogIndex):
> pass
> 
> Then I have implemented a class which implements this interface and have
> it registerd like this:
> 
> 
>  permission="zope.ManageServices"
> interface=".interfaces.ITestIndex
>  zope.index.interfaces.IStatistics"
> set_schema=".interfaces.ITestIndex"
> />
> 
> 
> If I restart zope and go to my catalog, I still can only add FieldIndex
> and TestIndex. What else do I have to do, to implement a custom index?

You need to specify an addMenuItem directive and associated "view" in
your package browser zcml to enable you to add your index objects via
the ZMI.  Look at zope/app/catalog/browser/configure.zcml as a starting
point, e.g.



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


Re: [Zope3-Users] Time Zones/Internationalization

2006-06-05 Thread David Pratt
Hi David. pytz is a standard python package included in zope that can 
help you manage time zone issues. There are methods to represent time 
that is properly offset according to a large database of global 
timezones. This will help you present the view of time you wish to your 
application's users. Refer to the documentation in the package to give 
you an idea of what is possible.


Regards,
David

David Johnson wrote:

How do you deal with time zones in your applications, in regards to
dates and times entered by users of the application. 


For example consider a content object that represents a store, and
includes the store hours.  A store owner may enter their opening ours as
0800 in their timezone.  Do you store this as 0800? How does locale fit
in both in terms of store owners and store customers (who may be in
different time zones)?




___
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


[Zope3-Users] Time Zones/Internationalization

2006-06-05 Thread David Johnson
How do you deal with time zones in your applications, in regards to
dates and times entered by users of the application. 

For example consider a content object that represents a store, and
includes the store hours.  A store owner may enter their opening ours as
0800 in their timezone.  Do you store this as 0800? How does locale fit
in both in terms of store owners and store customers (who may be in
different time zones)?




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


[Zope3-Users] Custom index implementation

2006-06-05 Thread Achim Domma

Hi,

I try to implement a custom index to be inserted into a catalog. I look 
at the code and it seems to me, that I only have to derive my interface 
from ICatalogIndex. I have defined my interface like this:


class ITestIndex(zope.app.catalog.interfaces.ICatalogIndex):
pass

Then I have implemented a class which implements this interface and have 
it registerd like this:






If I restart zope and go to my catalog, I still can only add FieldIndex 
and TestIndex. What else do I have to do, to implement a custom index?


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


Re: [Zope3-Users] Utilities

2006-06-05 Thread David Johnson
Thanks! That's it exactly!  I was misunderstanding the concept of a
utility with the name ''.  



On Mon, 2006-06-05 at 17:34 +0300, Albertas Agejevas wrote:
> On Mon, Jun 05, 2006 at 09:22:13AM -0500, David Johnson wrote:
> > 
> > > getUtility does not require a name.
> > 
> > I've tried getUtility() without a name it never returns an interface and
> > returns component lookup error.
> 
> Because you haven't registered a single utility with the given
> interface and name ''!
> 
> > I've tried in many different instances,
> > and I've ended up reverting as a work around to
> > getAllRegisteredUtilitiesFor(), which works just fine.
> 
> getAllRegisteredUtilitiesFor returns even the utilities that are
> "overriden" by closer utilities with the same name and interface.
> 
> > Once I add the name it works great. What am I missing? Is there
> > some other requirement?  My code looks the same as what you've
> > listed.
> 
> I suspect you expect getUtility(ISomething) to return a utility with
> *any* name of that interface (that's what
> get(AllRegistered)UtilitiesFor() does).  But getUtility(ISomething)
> returns just the utilities with the name you've passed ('' by default).
> 
> I think I already explained that in my previous email.
> 
> Albertas
> 

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


Re: [Zope3-Users] Found a (perhaps obvious) page template speedup

2006-06-05 Thread Marco Mariani

Chris Withers wrote:

The ZMI has a lot of widgets that people should want to re-use 
(generically: tree controls, file widgets, directory listings, etc, 
specifically: forms and configuration for the "generic" parts of zope)


It sounds like you're advocating writing every bit of UI from scratch, 
as you have to in Zope 2 due to the hard-coded nature of the ZMI, but 
I'm hoping I'm mistaken...


Am I?


Widgets are in zope.app.form.browser, and those can be use independently 
of ZMI

Forms are in zope.formlib (or zope.app.form), again independent of ZMI

Want menus? Again, they are *used* by ZMI but you can define your own 
with the same machinery..


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


Re: [Zope3-Users] Utilities

2006-06-05 Thread David Johnson

> getUtility does not require a name.

I've tried getUtility() without a name it never returns an interface and
returns component lookup error.  I've tried in many different instances,
and I've ended up reverting as a work around to
getAllRegisteredUtilitiesFor(), which works just fine.  Once I add the
name it works great. What am I missing? Is there some other requirement?
My code looks the same as what you've listed.  The documentation implies
that it does not need a name.  Is this a possible Zope 3 version issue
or bug? 









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


Re: [Zope3-Users] Found a (perhaps obvious) page template speedup

2006-06-05 Thread Chris Withers

Stephan Richter wrote:


The point is that I am not interesting in supporting the ZMI at all. I have no 
use for users or developers to ever use the ZMI. In fact, basing my skin on 
the ZMI is bad because it provides all those URLs I (a) do not have control 
over -- thus being a security risk, and (b) are not needed and make the 
system slower.


This is stupid.

One of the big wins for Zope 3 was that you were supposed to be able to 
re-use UI code without having to write it all from scratch.


The ZMI has a lot of widgets that people should want to re-use 
(generically: tree controls, file widgets, directory listings, etc, 
specifically: forms and configuration for the "generic" parts of zope)


It sounds like you're advocating writing every bit of UI from scratch, 
as you have to in Zope 2 due to the hard-coded nature of the ZMI, but 
I'm hoping I'm mistaken...


Am I?

Chris

--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] i18n questions

2006-06-05 Thread Chris Withers

Stephan Richter wrote:

On Friday 02 June 2006 03:52, Chris Withers wrote:

Stephan Richter wrote:

On Wednesday 31 May 2006 04:29, Chris Withers wrote:

- Can my existing .pot and .po files be used?

Yes, the PO file format is totally independent of Zope and Python.

But with PTS, I don't need to build .mo's myself, right? ;-)


I know absolutely nothing about PTS, this is a Zope 3 list.


I was telling you by way of a question...


- How do I ask the translation service what the currently negotiated
language is?

There are other
interfaces for this; I believe ILanguageNegotiator.

Will that let me find out what the currently negotiated language is?


Yes, that's the point of this API.


OK, is there example code anywhere for "tell me what zope3's i18n 
currently thinks the language is"?


How about "what are all the languages that have been registered for 
domain x?", although I guess that comes from a different interface, 
although surely one used by ILanguageNegotiator, since anything 
implementing that would need to know what all available languages are in 
order to know what choices it could pick from?



- How do I ask the translation service what all the available languages
are for a particular domain?

I do not think there is an API for that, but you could certainly develop
one.

Where and how would I do this? I'd suggest this is an oversight in the
existing API's and it'd be better to add to an existing API rather than
come up with a new one...


You can always write a proposal. But I would check the existing API first.


I will, where do proposals go nowadays?

As I said, Zope 3 does not support TTW development, so there are no tools 
built for such a task yet, though it would not be horribly tricky.


Would you see a message catalog that recorded untranslated msgids and in 
a file when they were requested as "horrible tricky"?


cheers,

Chris

--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] testing using placefulSetUp, zcml and events

2006-06-05 Thread Achim Domma

Hi,

I have a content object I want to set up in a IObjectCreatedEvent event 
handler. I want to use the interactive interpreter to play with this, 
but it looks like my configure.zcml is not parsed and executed if I use 
placefulSetUp.


How do I have to setup my environment to test zcml configured events 
from command line? Basically I want to write something like


some_setup_method()
root["ws"]=Workspace() # should trigger and handle IObjectCreatedEvent
for key in root["ws").keys():
print key

to check if the object is setup correctly.

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


Re: [Zope3-Users] Utilities

2006-06-05 Thread Albertas Agejevas
On Mon, Jun 05, 2006 at 01:14:58AM -0500, David Johnson wrote:
> What is the best to find the nearest utility without using a name? 
> 
> zapi.getUtility() seems to require a name (though the documentation
> implies otherwise).

The default name is ''.  If you're asking for z.c.getUtility(ISomething),
you'll get that -- the nearest utility with a given interface and name
''.  These used to be called services three years ago.

> zapi.getAllRegisiteredUtilitiesFor() works but it
> seems to me if you have lots of utilities in other contexts, it would
> query those as well, and thereby be slow in a large application.
> 
> I come across this problem frequently and haven't figured out the best
> way to deal with it.

If you want to get all utilities with a given interface, use
z.c.getUtilitiesFor(ISomething).  You'll get the nearest utility with
each given name.

Albertas


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


Re : Re : [Zope3-Users] Uploading files

2006-06-05 Thread Stéphane Brault
Thanks Tarek,
 
 in fact I just need a simple thing:
 the user upload a text file which I then parse and update a database. I also 
need to let the user upload images which I then put in a folder (this will 
probably be done with ftp).
 So my main concern is to let the user upload text files, which I don't need to 
save. I'm sure I only need a simple thing to do but I don't know the 
techniques. Also if there's no simple way in ajax, I don't mind going another 
way, I still need to know how to do it though.
 
 Stéphane

- Message d'origine 
De : Tarek Ziadé <[EMAIL PROTECTED]>
À : Stéphane Brault <[EMAIL PROTECTED]>
Cc : zope3-users@zope.org
Envoyé le : Jeudi, 1 Juin 2006, 4h59mn 42s
Objet : Re: Re : [Zope3-Users] Uploading files

Stéphane Brault wrote:

>Thanks Stephan,
>  could you indicate me another way to upload files ?
>  
>  Stéphane
>
>- Message d'origine 
>De : Stephan Richter <[EMAIL PROTECTED]>
>À : zope3-users@zope.org; Stéphane Brault <[EMAIL PROTECTED]>
>Envoyé le : Jeudi, 1 Juin 2006, 2h53mn 32s
>Objet : Re: [Zope3-Users] Uploading files
>
>On Tuesday 30 May 2006 09:30, Stéphane Brault wrote:
>  
>
>> for my application I mainly use sqlos and jsonserver, which means that I
>>don't use much standard Zope components, I need to let users upload a file
>>which I parse to update the database. I don't see how to upload files with
>>AJAX. Is there a way or should I go another way. I must say I don't know
>>how to do it the standard way.
>>
>>
>
>While I hate AJAX with a passion, you could certainly do this. If JS has a way 
>to access a local file once it has been selected, then you can use the 
>XmlHttpRequest class to PUT the file on the server, for example. I certainly 
>would not use JSON for this task.
>
>Regards,
>Stephan
>  
>
You cannot upload file directly in javascript, because it can't reach
the file system to get the file (it's all about security)

the recipe is to use an IFrame in your form, to get back the hand into
the client,
then do what you need to do on client side while your file is beeing
uploaded.

What your precise use case ?

Tarek



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


Re: [Zope3-Users] Utilities

2006-06-05 Thread Florian Lindner
Am Montag, 5. Juni 2006 08:14 schrieb David Johnson:
> What is the best to find the nearest utility without using a name?
>
> zapi.getUtility() seems to require a name (though the documentation
> implies otherwise). zapi.getAllRegisiteredUtilitiesFor() works but it
> seems to me if you have lots of utilities in other contexts, it would
> query those as well, and thereby be slow in a large application.

getUtility does not require a name.

Example:

from zope.app.zapi import getUtility
from zope.app.homefolder.interfaces import IHomeFolderManager
hfm = getUtility(IHomeFolderManager)

Regards,

Florian


>
> I come across this problem frequently and haven't figured out the best
> way to deal with it.
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users