[Checkins] SVN: Sandbox/luciano/kirbi/src/kirbi/ renamed users module to user

Luciano Ramalho luciano at ramalho.org
Mon Aug 13 19:54:27 EDT 2007


Log message for revision 78806:
  renamed users module to user
  

Changed:
  U   Sandbox/luciano/kirbi/src/kirbi/app.py
  U   Sandbox/luciano/kirbi/src/kirbi/tests/test_doctests.py
  A   Sandbox/luciano/kirbi/src/kirbi/user.py
  A   Sandbox/luciano/kirbi/src/kirbi/user_templates/
  D   Sandbox/luciano/kirbi/src/kirbi/users.py
  D   Sandbox/luciano/kirbi/src/kirbi/users_templates/

-=-
Modified: Sandbox/luciano/kirbi/src/kirbi/app.py
===================================================================
--- Sandbox/luciano/kirbi/src/kirbi/app.py	2007-08-13 23:53:28 UTC (rev 78805)
+++ Sandbox/luciano/kirbi/src/kirbi/app.py	2007-08-13 23:54:27 UTC (rev 78806)
@@ -2,15 +2,15 @@
 from grok import index
 from kirbi.pac import Pac
 from kirbi.book import Book
-from kirbi.users import UserFolder
-from zope.interface import Interface
+from kirbi.user import UserFolder
+from zope.interface import Interface, implements
 
 class Kirbi(grok.Application, grok.Container):
     """ Peer-to-peer library system """
     def __init__(self):
         super(Kirbi, self).__init__()
         self['pac'] = Pac()
-        self['users'] = UserFolder()
+        self['u'] = UserFolder()
 
 class Index(grok.View):
     pass # see app_templates/index.pt
@@ -30,4 +30,3 @@
 class Master(grok.View):
     """ The master page template macro """
     grok.context(Interface)
-    

Modified: Sandbox/luciano/kirbi/src/kirbi/tests/test_doctests.py
===================================================================
--- Sandbox/luciano/kirbi/src/kirbi/tests/test_doctests.py	2007-08-13 23:53:28 UTC (rev 78805)
+++ Sandbox/luciano/kirbi/src/kirbi/tests/test_doctests.py	2007-08-13 23:54:27 UTC (rev 78806)
@@ -2,7 +2,7 @@
 import unittest
 
 def test_suite():
-    modules = ['app', 'pac', 'book']
+    modules = ['app', 'pac', 'book', 'user']
     suite = unittest.TestSuite()
     for module in modules:
         module_name = 'kirbi.' + module

Copied: Sandbox/luciano/kirbi/src/kirbi/user.py (from rev 78805, Sandbox/luciano/kirbi/src/kirbi/users.py)
===================================================================
--- Sandbox/luciano/kirbi/src/kirbi/user.py	                        (rev 0)
+++ Sandbox/luciano/kirbi/src/kirbi/user.py	2007-08-13 23:54:27 UTC (rev 78806)
@@ -0,0 +1,79 @@
+import grok
+from zope.app.authentication.interfaces import IPrincipalInfo
+from zope.interface import implements, invariant, Invalid
+import sha
+
+class UserFolder(grok.Container):
+    pass
+
+class User(object):
+    """
+    A Kirbi user. To implement IPrincipalInfo but still use more familiar
+    attribute names, we use properties to make ``id`` the same as ``login``
+    and ``title`` the same as ``name``.
+
+    >>> alice = User('alice', u'Vincent Damon Furnier', u'headless-chicken')
+    >>> alice.id, alice.title, alice.description
+    ("alice", u"Vincent Damon Furnier", u"Vincent Damon Furnier (alice)")
+    
+    >>> alice.title = u'Alice Cooper'
+    >>> alice.name
+    u"Alice Cooper"
+    
+    >>> alice.passwd_hash
+    ABC
+
+    """
+
+    implements(IPrincipalInfo)
+    
+    login = ''
+    name = ''
+    passwd_hash = ''
+        
+    def __init__(self, login, name, passwd):
+        self.login = login
+        self.name = name
+        self.passwd = sha.new(passwd).hexdigest()
+
+    def getId(self):
+        return self.login
+
+    def setId(self, id):
+        self.login = id
+
+    id = property(getId, setId)
+
+    def getTitle(self):
+        return self.name
+
+    def setTitle(self, title):
+        self.name = title
+
+    id = property(getId, setId)
+
+    @property
+    def description(self):
+        return '%s (%s)' % (self.name, self.login)
+    
+    
+        
+
+
+class Index(grok.View):
+    grok.context(UserFolder)
+    def update(self, query=None):
+        self.results_title = '%d users' % len(self.context)
+
+    
+class Register(grok.AddForm):
+    grok.context(UserFolder)
+    """ User registration form """
+    
+    form_fields = grok.AutoFields(IPrincipalInfo)
+
+    @grok.action('Add entry')
+    def add(self, **data):
+        self.context[id] = User(**data)
+        self.redirect(self.url('users'))
+

Copied: Sandbox/luciano/kirbi/src/kirbi/user_templates (from rev 78751, Sandbox/luciano/kirbi/src/kirbi/users_templates)

Deleted: Sandbox/luciano/kirbi/src/kirbi/users.py
===================================================================
--- Sandbox/luciano/kirbi/src/kirbi/users.py	2007-08-13 23:53:28 UTC (rev 78805)
+++ Sandbox/luciano/kirbi/src/kirbi/users.py	2007-08-13 23:54:27 UTC (rev 78806)
@@ -1,79 +0,0 @@
-import grok
-from zope.app.authentication.interfaces import IPrincipalInfo
-from zope.interface import implements, invariant, Invalid
-import sha
-
-class UserFolder(grok.Container):
-    pass
-
-class User(object):
-    """
-    A Kirbi user. To implement IPrincipalInfo but still use more familiar
-    attribute names, we use properties to make ``id`` the same as ``login``
-    and ``title`` the same as ``name``.
-
-    >>> alice = User('alice', u'Vincent Damon Furnier', u'headless-chicken')
-    >>> alice.id, alice.title, alice.description
-    ("alice", u"Vincent Damon Furnier", u"Vincent Damon Furnier (alice)")
-    
-    >>> alice.title = u'Alice Cooper'
-    >>> alice.name
-    u"Alice Cooper"
-    
-    >>> alice.passwd_hash
-    ABC
-
-    """
-
-    implements(IPrincipalInfo)
-    
-    login = ''
-    name = ''
-    passwd_hash = ''
-        
-    def __init__(self, login, name, passwd):
-        self.login = login
-        self.name = name
-        self.passwd = sha.new(passwd).hexdigest()
-
-    def getId(self):
-        return self.login
-
-    def setId(self, id):
-        self.login = id
-
-    id = property(getId, setId)
-
-    def getTitle(self):
-        return self.name
-
-    def setTitle(self, title):
-        self.name = title
-
-    id = property(getId, setId)
-
-    @property
-    def description(self):
-        return '%s (%s)' % (self.name, self.login)
-    
-    
-        
-
-
-class Index(grok.View):
-    grok.context(UserFolder)
-    def update(self, query=None):
-        self.results_title = '%d users' % len(self.context)
-
-    
-class Register(grok.AddForm):
-    grok.context(UserFolder)
-    """ User registration form """
-    
-    form_fields = grok.AutoFields(IPrincipalInfo)
-
-    @grok.action('Add entry')
-    def add(self, **data):
-        self.context[id] = User(**data)
-        self.redirect(self.url('users'))
-



More information about the Checkins mailing list