[Checkins] SVN: hurry.resource/branches/janjaapdriessen-resource-publisher/src/hurry/resource/ quick test for library lookup by name

Jan-Wijbrand Kolman janwijbrand at gmail.com
Wed Nov 24 10:48:55 EST 2010


Log message for revision 118563:
  quick test for library lookup by name

Changed:
  U   hurry.resource/branches/janjaapdriessen-resource-publisher/src/hurry/resource/README.txt
  U   hurry.resource/branches/janjaapdriessen-resource-publisher/src/hurry/resource/__init__.py
  U   hurry.resource/branches/janjaapdriessen-resource-publisher/src/hurry/resource/core.py

-=-
Modified: hurry.resource/branches/janjaapdriessen-resource-publisher/src/hurry/resource/README.txt
===================================================================
--- hurry.resource/branches/janjaapdriessen-resource-publisher/src/hurry/resource/README.txt	2010-11-24 15:39:49 UTC (rev 118562)
+++ hurry.resource/branches/janjaapdriessen-resource-publisher/src/hurry/resource/README.txt	2010-11-24 15:48:55 UTC (rev 118563)
@@ -1,7 +1,6 @@
 hurry.resource
 **************
 
-
 Introduction
 ============
 
@@ -32,17 +31,17 @@
 ==================
 
 A hurry.resource Library 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 (rootpath) that this
-library publishes. In the ``mypackage``, which was installed during
-setup of this test, we define a resource ``foo``::
+as it should be published under in a URL and uniquely identify it, and
+a path to the root of the resources (rootpath) that this library
+publishes. In the ``mypackage``, which was installed during setup of
+this test, we define a resource ``foo``::
 
   >>> from mypackage import foo
   >>> foo.name
   'foo'
 
-The full path to the directory with the resources is reconstructed from
-the package that the Library is defined in::
+The full path to the directory with the resources is reconstructed
+from the package that the Library is defined in::
 
   >>> foo.path
   '...test-installs/mypackage-1.0dev.../mypackage/resources'
@@ -70,6 +69,17 @@
   >>> list(libraries())
   [<hurry.resource.core.Library object at ...>]
 
+A library can be looked-up by name as well::
+
+  >>> from hurry.resource import library_by_name
+  >>> library_by_name('foo')
+  <hurry.resource.core.Library object at ...>
+
+  >>> library_by_name('bar')
+  Traceback (most recent call last):
+  ...
+  KeyError: 'bar'
+
 Inclusion
 =========
 

Modified: hurry.resource/branches/janjaapdriessen-resource-publisher/src/hurry/resource/__init__.py
===================================================================
--- hurry.resource/branches/janjaapdriessen-resource-publisher/src/hurry/resource/__init__.py	2010-11-24 15:39:49 UTC (rev 118562)
+++ hurry.resource/branches/janjaapdriessen-resource-publisher/src/hurry/resource/__init__.py	2010-11-24 15:48:55 UTC (rev 118563)
@@ -1,5 +1,6 @@
 from hurry.resource.core import (Library,
                                  libraries,
+                                 library_by_name,
                                  ResourceInclusion,
                                  GroupInclusion,
                                  NeededInclusions)

Modified: hurry.resource/branches/janjaapdriessen-resource-publisher/src/hurry/resource/core.py
===================================================================
--- hurry.resource/branches/janjaapdriessen-resource-publisher/src/hurry/resource/core.py	2010-11-24 15:39:49 UTC (rev 118562)
+++ hurry.resource/branches/janjaapdriessen-resource-publisher/src/hurry/resource/core.py	2010-11-24 15:48:55 UTC (rev 118563)
@@ -43,7 +43,7 @@
     return libs
     
 def libraries():
-    return _libraries().values()
+    return _libraries().itervalues()
 
 def library_by_name(name):
     return _libraries()[name]



More information about the checkins mailing list