[Repoze-dev] Chameleon 2.x

2011-02-25 Thread Malthe Borch
The current development target for Chameleon 2.0 [1] is now stable and
seems to be compatible with Pyramid (tests run). For information on
what's new, see the readme.

Minimum Python version is 2.5 (and compatible up to 3.2). PyPy is also
supported (only fast-forward branch tested, but should work on newest
release).

If you have time to take it for a test drive, please do so and provide
feedback either here (if specific to Pyramid / repoze) or as an issue
on the tracker.

Thanks!

\malthe

[1] https://github.com/malthe/chameleon
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] Chameleon 2.x

2011-02-25 Thread Malthe Borch
Hey Attila,

Use git to clone the repository, or simply download it as an archive
from the page.

Then add a ``develop`` section to your buildout, e.g.

[buildout]

develop = ../chameleon2
eggs = Chameleon

\malthe

On 25 February 2011 13:36, Attila Oláh  wrote:
> Hello Malthe,
>
> On Fri, Feb 25, 2011 at 12:14, Malthe Borch  wrote:
>> The current development target for Chameleon 2.0 [1] is now stable and
>> seems to be compatible with Pyramid (tests run). For information on
>> what's new, see the readme.
>
> I'd like to test-drive Chameleon 2 with a Pyramid app I'm currently
> working on (that needs to run on App Engine), but I can't update, as
> there's no link to version 2.0 on pypi (yet). I'm using buildout, what
> should I do to get version 2.0 (e.g. add the GitHub repo to
> find-links)? Or have you released it to another pypi server?
>
> Attila
>
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] sorting API for repoze.folder?

2011-02-25 Thread Danny Navarro
Hi guys,

Ideally I would like to be able to do something like this with a repoze Folder:

>>>  from repoze.folder import Folder

>>>  class MyFolder(Folder):
>>>  def __init__(self):
>>>  Folder.__init__(self)
>>>  self.sort_key = lambda x: self[x].attr
>>>
>>>  f = MyFolder()
>>>  f['a'] = obj1 # obj1.attr -> 10
>>>  f['b'] = obj2 # obj2.attr -> 20
>>>  f.order
[u'a', u'b']
>>>  f.values()
[obj1, obj2]
>>>  f.is_sorted
False
>>>  f.sort(reverse=True)
>>>  f.order
[u'b', u'a']
>>>  f.values()
[obj2, obj1]
>>>  f.is_sorted()
>>>  True
>>>  f['c'] = obj3 # obj3.attr -> 15
>>>  f.order
[u'b', u'a', u'c']
>>>  f.is_sorted
False
>>>  f.sort()
>>>  f.order()
[u'b', u'c', u'a']
>>>  f.values()
[obj2, obj3, obj1]
>>>  f.is_sorted
>>>  True

These are the assumptions I made when thinking of this behavior,
correct me if they are wrong.

 - I want to call sort explicitly because I think sorting every time
an object is inserted is slower than sorting after I'm finished adding
a batch objects.

 - It's faster to have order stored instead of sorting dynamically
every time I ask for order.

I also suspect that for folders with lots of items a list for order
may not be the most efficient. What would be the persistent equivalent
to an efficient list with ZODB? An IOBTree?

I think I can to modify repoze.folder to support this behavior. Would
a patch for repoze.folder be welcomed? I know for complex sortings it
would be better to use repoze.catalog but I see it as the default
order folder.

I also miss itervalues() and iteritems(), I can also work on adding
them if you think it will be good to have.

Regards,

--
Danny Navarro  |  http://dannynavarro.net
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev