Show
Ignore:
Timestamp:
11/03/07 17:17:44 (6 years ago)
Author:
ged
Message:
  • minor style improvements, correct typos, ...
  • bump version to 0.4.1
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • elixir/trunk/elixir/ext/encrypted.py

    r236 r263  
    1717        password = Field(Unicode) 
    1818        ssn = Field(Unicode) 
    19         acts_as_encrypted(for_columns=['password', 'ssn'], with_secret='secret') 
     19        acts_as_encrypted(for_columns=['password', 'ssn'],  
     20                          with_secret='secret') 
    2021 
    2122The above Person entity will automatically encrypt and decrypt the password and 
     
    2829from sqlalchemy.orm         import MapperExtension, EXT_PASS 
    2930 
     31__all__ = ['acts_as_encrypted'] 
     32__doc_all__ = [] 
    3033 
    3134# 
     
    3437 
    3538def encrypt_value(value, secret): 
    36     return Blowfish.new(secret, Blowfish.MODE_CFB).encrypt(value).encode('string_escape') 
     39    return Blowfish.new(secret, Blowfish.MODE_CFB) \ 
     40                   .encrypt(value).encode('string_escape') 
    3741 
    3842def decrypt_value(value, secret): 
    39     return Blowfish.new(secret, Blowfish.MODE_CFB).decrypt(value.decode('string_escape')) 
     43    return Blowfish.new(secret, Blowfish.MODE_CFB) \ 
     44                   .decrypt(value.decode('string_escape')) 
    4045 
    4146 
     
    7075                return EXT_PASS 
    7176             
    72             def populate_instance(self, mapper, selectcontext, row, instance, *args, **kwargs): 
    73                 mapper.populate_instance(selectcontext, instance, row, *args, **kwargs) 
     77            def populate_instance(self, mapper, selectcontext, row, instance,  
     78                                  *args, **kwargs): 
     79                mapper.populate_instance(selectcontext, instance, row,  
     80                                         *args, **kwargs) 
    7481                perform_decryption(instance) 
    7582                return True 
     
    8188acts_as_encrypted = Statement(ActsAsEncrypted) 
    8289 
    83  
    84 __all__ = [ 
    85     'acts_as_encrypted' 
    86 ]