[Zope3-Users] Various zope3 packages release

2007-10-03 Thread Shaar Gabriel
Hi

I've created some generic packages while working on an application and put 
them on http://www.jellofishi.com/zope. The code was last touched about half 
a year ago, and was last tested against 3.3.1. Please excuse any stupidities 
or anything that is no longer relevant, and enjoy :)

I don't read the list too often, so any feedback or questions should be sent 
directly to me.
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] z.a.component.vocabulary.UtilityNameTerm bad implementation ?

2007-03-31 Thread Shaar Gabriel
On Saturday 31 March 2007 19:41:35 Marius Gedminas wrote:
> On Sat, Mar 31, 2007 at 08:51:44AM +0300, Shaar Gabriel wrote:
> > hi
> > using zope3.3.0 on gentoo
> >
> > zope.app.component.vocabulary.UtilityNameTerm is marked as implementing
> > ITokenizedTerm, but in fact tries to implement ITitledTokenizedTerm, and
> > fails at that, because token and title are implemented as methods not
> > properties. bug ?
>
> I think so.  BTW, the UtilityName vocabulary that uses UtilityNameTerms
> does not appear to be used anywhere.
>
> Marius Gedminas

I've found a use for it when i was fixing the zope3 wrapper code for 
textindexng3 (3.2.0), which as far as i can tell was broken.
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] z.a.component.vocabulary.UtilityNameTerm bad implementation ?

2007-03-30 Thread Shaar Gabriel
hi
using zope3.3.0 on gentoo

zope.app.component.vocabulary.UtilityNameTerm is marked as implementing 
ITokenizedTerm, but in fact tries to implement ITitledTokenizedTerm, and 
fails at that, because token and title are implemented as methods not 
properties. bug ?
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] problem trying to use layers in a custom skin

2007-02-21 Thread Shaar Gabriel
On Tuesday 20 February 2007 14:06, Shaar Gabriel wrote:

> hi. (using zope 3.3.0)
>
> i'm trying to make my own skin, using rotterdam as a basic layer, and
> adding my own layer.
>
> this is what i have so far :
>
> the classes :
>
> class jzclean(IBrowserRequest):
> """Layer for registering jzclean-specific resources."""
>
> class JZClean(jzclean, rotterdam, IDefaultBrowserLayer):
> """The ``JZClean`` skin.
>
> It is available via ``++skin++JZClean``.
> """
>
> configure.zcml :
>
>  interface=".JZClean"
>   type="zope.publisher.interfaces.browser.IBrowserSkinType"
>   name="JZClean"
>   />
>
>  name="zope3_tablelayout.css"
>   file="resources/zope3_tablelayout.css"
>   layer=".jzclean"
>   />
>
> and then i set the default skin to JZClean :
>
>   
>
> when i go to http://localhost:8080/@@/zope3_tablelayout.css i get the
> rotterdam version. when i remove rotterdam from the layers, i get my
> version. tried moving rotterdam and jzclean around in the inheritance list,
> but that didn't help. could somebody give me a clue ?
> ___
> Zope3-users mailing list
> Zope3-users@zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users

replying to my own question.
this seems to have been a browser cache hiccup. works ok now.
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] problem trying to use layers in a custom skin

2007-02-20 Thread Shaar Gabriel
hi. (using zope 3.3.0)

i'm trying to make my own skin, using rotterdam as a basic layer, and adding 
my own layer.

this is what i have so far :

the classes :

class jzclean(IBrowserRequest):
"""Layer for registering jzclean-specific resources."""

class JZClean(jzclean, rotterdam, IDefaultBrowserLayer):
"""The ``JZClean`` skin.

It is available via ``++skin++JZClean``.
"""

configure.zcml :





and then i set the default skin to JZClean :



when i go to http://localhost:8080/@@/zope3_tablelayout.css i get the 
rotterdam version. when i remove rotterdam from the layers, i get my version.
tried moving rotterdam and jzclean around in the inheritance list, but that 
didn't help. could somebody give me a clue ?
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] problems using os.popen2 in a heavily used utility

2007-01-30 Thread Shaar Gabriel
Hi.
i have a utility that generates thumbnails for objects that can be displayed 
as an image (faxes).

the part that generates the thumbnail :

def generate_thumbnail(self, data):
"""Return a smaller view of the data stream"""

# if data stream is a djvu file, convert it to ps before 
thumbnailing.
magic = getUtility(IFileMagic)
mimetype = magic.getMimeType(data)
if mimetype == "image/x.djvu":
(stdin, stdout) = os.popen2("djvups - -")
stdin.write(data)
stdin.close()
data = stdout.read()
stdout.close()
# Explenation of convert command line attributes :
# -resize 150 : resize, while keeping aspect ratio, to a width 
of 150 pixels
# -[1] : input file in stdin (-)  to extract only frame 1: 
-[1]).
#format detected automatically from data stream
# png:- : output file on stdout (-) in png (png:) format
(stdin, stdout) = os.popen2("convert -quiet -resize 150 - 
png:-")
stdin.write(data)
stdin.close()
thumbnail = stdout.read()
stdout.close()
return thumbnail

this utility is used by a view that displays a grid of a few thumbnails.
when the view is loaded, several thumbnails are generated at once. (calls from 
the  tags to an /@@thumbnail view on the obect)
some thumbnail make it through (very few), the rest fail with :

2007-01-30T21:54:06 ERROR SiteError 
http://moobox:8080/2007/inbox/05512/@@thumbnail
Traceback (most recent call last):
  File "/usr/lib/zope-3.3.0/lib/python/zope/publisher/publish.py", line 133, 
in publish
result = publication.callObject(request, obj)
  
File "/usr/lib/zope-3.3.0/lib/python/zope/app/publication/zopepublication.py", 
line 161, in callObject
return mapply(ob, request.getPositionalArguments(), request)
  File "/usr/lib/zope-3.3.0/lib/python/zope/publisher/publish.py", line 108, 
in mapply
return debug_call(obj, args)
   - __traceback_info__: >
  File "/usr/lib/zope-3.3.0/lib/python/zope/publisher/publish.py", line 114, 
in debug_call
return obj(*args)
  File "/var/lib/zope/office/lib/python/base/visual/browser.py", line 59, in 
__call__
tf.write(self.data)
  File "/var/lib/zope/office/lib/python/base/thumbnail/browser/thumbnail.py", 
line 41, in data
return getAdapter(self.context, IVisual, name="thumbnail").data
  File "/var/lib/zope/office/lib/python/base/thumbnail/thumbnail.py", line 21, 
in data
thumbnail = tg.get_thumbnail(self.context)
  File "/var/lib/zope/office/lib/python/base/thumbnail/utility.py", line 80, 
in get_thumbnail
thumb.image = StringIO(
  File "/var/lib/zope/office/lib/python/base/thumbnail/utility.py", line 67, 
in generate_thumbnail
thumbnail = stdout.read()
IOError: [Errno 4] Interrupted system call


i read somewhere that os.popen2 is not friendly towards twisted framework, and 
that twisted.internet.reactor.spawnProcess or 
twisted.internet.process.Process should be used.
i can't undersnad what format the parameter childfds should look like when 
calling those. could somebody show me the equivalent of (stdin, stdout) = 
os.popen2() ?

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


Re: [Zope3-Users] zc.relationship or hurry.query and global intid utility

2007-01-07 Thread Shaar Gabriel
Thanks.
this sorted out a few things in my understanding.

On Sunday 07 January 2007 02:56, Stephan Richter wrote:
> On Saturday 06 January 2007 13:14, Gabi Shaar wrote:
> > could somebody point me at a simple example of how to create the intid
> > utility these packages are looking for ?
>
> Here is some code registering the stuff programmatically. Frank already
> told you the correct solution for doing this via the ZMI.
>
> from zope.app import intid
> from zope.app.catalog import catalog
> from zope.app.component import hooks
> from zope.security.proxy import removeSecurityProxy
> from zc.catalog import index, catalogindex
>
>
> # Get the local site manager
> sm = removeSecurityProxy(self.context.getSiteManager())
>
> # Create an intid utility
> if 'ids' not in sm['default']:
> ids = intid.IntIds()
> sm['default']['ids' ] = ids
> sm.registerUtility(ids, intid.interfaces.IIntIds)
>
> # Create a catalog
> ctlg = catalog.Catalog()
> sm['default'][name] = ctlg
> sm.registerUtility(ctlg, zope.app.catalog.interfaces.ICatalog,
>name=name)
>
> # Set the site, so that the indices don't go crazy
> originalSite = hooks.getSite()
> hooks.setSite(self.context)
>
> # Add indices
> ctlg['name'] = catalogindex.ValueIndex('name', IContained)
> ctlg['interfaces'] = InterfacesIndex()
>
> # Reset the site
> hooks.setSite(originalSite)
>
> Regards,
> Stephan
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] zc.relationship or hurry.query and global intid utility

2007-01-07 Thread Shaar Gabriel
hi. thanks for the quick reply.

On Saturday 06 January 2007 21:40, FB wrote:
> On Sat, Jan 06, 2007 at 08:14:52PM +0200, Gabi Shaar wrote:
> > hi.
> > i am trying to use zope 3.3.0
> >
> > first somebody correct me if i'm wrong.
> >
> > getUtility(IIntIds) looks for an intid utility registerd in the global
> > site manager. if i supply a context, then it looks in the local site.
> >
> > i am trying to use zc.relationship and hurry.query. both seem to look for
> > a globally registered intid/catalog utility (at least as i understand
> > it). i can only wrap my brain around how to create a local intid/catalog
> > utility.
> >
> > could somebody point me at a simple example of how to create the intid
> > utility these packages are looking for ?
>
> Go to the site manager:
>
>  http://zopeserver/++etc+site/default
>
> create a IntId-Utility by selecting it from the "Add object" menu. Change
> to the newly create intid, select the "Registration" tab and add a
> registration.

did that. zmi now sais :
This object is registered: 
zope.app.intid.interfaces.IIntIds utility

>
> The next time, getUtility(IIntIds) should return that object.
>
> This utility is the one thing you should create before any other object
> because objects created prior to this utility will never have a unique ID.
>

a debug session :
daemon manager not running
zopectl> start
. --
2007-01-07T13:55:52 INFO root daemonizing the process
daemon process started, pid=13163
zopectl> stop
. daemon process stopped
zopectl> debug
No handlers could be found for logger "ZODB.FileStorage"
>>> from zope.component import getUtility
>>> from zope.app.intid.interfaces import IIntIds
>>> getUtility(IIntIds)
Traceback (most recent call last):
  File "", line 1, in ?
  File "/usr/lib/zope-3.3.0/lib/python/zope/component/_api.py", line 207, in 
getUtility
raise ComponentLookupError(interface, name)
zope.component.interfaces.ComponentLookupError: (, '')

> Regards,
>
> Frank
> ___
> 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