[Checkins] SVN: hurry.resource/trunk/ Added a path attribute to Library.
Vincent Fretin
vincent.fretin at gmail.com
Fri Jul 23 12:52:38 EDT 2010
Log message for revision 114965:
Added a path attribute to Library.
Changed:
U hurry.resource/trunk/CHANGES.txt
U hurry.resource/trunk/src/hurry/resource/README.txt
U hurry.resource/trunk/src/hurry/resource/core.py
-=-
Modified: hurry.resource/trunk/CHANGES.txt
===================================================================
--- hurry.resource/trunk/CHANGES.txt 2010-07-23 16:35:29 UTC (rev 114964)
+++ hurry.resource/trunk/CHANGES.txt 2010-07-23 16:52:38 UTC (rev 114965)
@@ -4,7 +4,7 @@
0.9.1 (unreleased)
================
-* Nothing changed yet.
+* Added a path attribute to Library.
0.9 (2010-07-13)
================
Modified: hurry.resource/trunk/src/hurry/resource/README.txt
===================================================================
--- hurry.resource/trunk/src/hurry/resource/README.txt 2010-07-23 16:35:29 UTC (rev 114964)
+++ hurry.resource/trunk/src/hurry/resource/README.txt 2010-07-23 16:52:38 UTC (rev 114965)
@@ -31,11 +31,18 @@
A resource library
==================
-We define a library ``foo``::
+We define a library ``foo``. It takes two arguments, the name of the library
+as it should be published under in a URL and uniquely identify it, and a path
+to the root of the resources that this library publishes::
>>> from hurry.resource import Library
- >>> foo = Library('foo')
+ >>> foo = Library('foo', 'dummy')
+The full path to the directory with the resources is reconstructed::
+
+ >>> foo.path #doctest: +ELLIPSIS
+ '.../hurry.resource/src/hurry/resource/dummy'
+
Inclusion
=========
Modified: hurry.resource/trunk/src/hurry/resource/core.py
===================================================================
--- hurry.resource/trunk/src/hurry/resource/core.py 2010-07-23 16:35:29 UTC (rev 114964)
+++ hurry.resource/trunk/src/hurry/resource/core.py 2010-07-23 16:52:38 UTC (rev 114965)
@@ -1,5 +1,6 @@
import os
from types import TupleType
+import pkg_resources
try:
from zope.interface import implements
@@ -17,8 +18,9 @@
class Library(object):
implements(interfaces.ILibrary)
- def __init__(self, name):
+ def __init__(self, name, rootpath):
self.name = name
+ self.path = pkg_resources.resource_filename(__name__, rootpath)
class InclusionBase(object):
implements(interfaces.IInclusion)
More information about the checkins
mailing list