Changeset 3589

Show
Ignore:
Timestamp:
05/04/08 18:46:24 (7 months ago)
Author:
coderanger
Message:

Mostly untested upgrade to 0.11 APIs.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • traccasplugin/0.11/setup.py

    r3416 r3589  
    66setup( 
    77    name = 'TracCAS', 
    8     version = '1.0', 
     8    version = '2.0', 
    99    packages = ['traccas'], 
    1010 
    11     author = "Noah Kantrowitz", 
    12     author_email = "noah@coderanger.net", 
    13     description = "A modified authentication plugin to use the Yale CAS system.", 
    14     license = "BSD", 
    15     keywords = "trac cas authentication plugin", 
    16     url = "http://trac-hacks.org/wiki/TracCASPlugin", 
     11    author = 'Noah Kantrowitz', 
     12    author_email = 'noah@coderanger.net', 
     13    description = 'A modified authentication plugin to use the Yale CAS system.', 
     14    license = 'BSD', 
     15    keywords = 'trac plugin cas authentication', 
     16    url = 'http://trac-hacks.org/wiki/TracCASPlugin', 
     17 
     18    install_requires = ['Trac'], 
    1719 
    1820    entry_points = { 
  • traccasplugin/0.11/traccas/traccas.py

    r3587 r3589  
    77from trac.util import escape, hex_entropy, Markup 
    88from trac.web.auth import LoginModule 
     9from genshi.builder import tag 
     10 
    911from pycas import PyCAS 
    1012 
     
    1921    validate_path = Option('cas', 'validate_path', default='/validate',  
    2022                        doc='Path component for the validation system') 
    21      
    22     def __init__(self): 
    23         paths = { 
    24             'login_path': self.login_path, 
    25             'logout_path': self.logout_path, 
    26             'validate_path': self.validate_path, 
    27         } 
    28         self.cas = PyCAS(self.server, **paths) 
    2923         
    3024    # IAuthenticatorMethods 
     
    4135    def get_navigation_items(self, req):         
    4236        if req.authname and req.authname != 'anonymous': 
    43             yield ('metanav', 'login', 'logged in as %s' % req.authname) 
    44             yield ('metanav', 'logout', Markup('<a href="%s">Logout</a>' % escape(req.href.logout()))) 
     37            yield 'metanav', 'login', 'logged in as %s' % req.authname 
     38            yield 'metanav', 'logout', tag.a('Logout', href=req.href.logout()) 
    4539        else: 
    46             yield ('metanav', 'login', Markup('<a href="%s">Login</a>' % escape(self.cas.login_url(req.abs_href.login())))) 
    47          
     40            yield 'metanav', 'login', tag.a('Login', href=self.cas.login_url(req.abs_href.login())) 
    4841 
    4942    # Internal methods 
     
    5952        else: 
    6053            req.redirect(req.abs_href()) 
     54     
     55    def cas(self): 
     56        paths = { 
     57            'login_path': self.login_path, 
     58            'logout_path': self.logout_path, 
     59            'validate_path': self.validate_path, 
     60        } 
     61        return PyCAS(self.server, **paths) 
     62    cas = property(cas)