Author: jtauber
Date: Sat Sep 27 06:14:26 2008
New Revision: 952
Modified:
trunk/local_apps/zwitschern/pownce_utils.py
Log:
converted tabs to spaces
Modified: trunk/local_apps/zwitschern/pownce_utils.py
==============================================================================
--- trunk/local_apps/zwitschern/pownce_utils.py (original)
+++ trunk/local_apps/zwitschern/pownce_utils.py Sat Sep 27 06:14:26 2008
@@ -8,28 +8,28 @@
from django.conf import settings
def pownce_account_raw(username, password):
- return pownce.Api(username, password,
'li6yw8q8ivv8ga9zda28iio4z652377y')
+ return pownce.Api(username,
password, 'li6yw8q8ivv8ga9zda28iio4z652377y')
def pownce_account_for_user(user):
- profile = user.get_profile()
- if profile.pownce_user and profile.pownce_password:
- pownce_password =
get_pownce_password(settings.SECRET_KEY,profile.pownce_password,
decode=True)
- return pownce_account_raw(profile.pownce_user, pownce_password)
+ profile = user.get_profile()
+ if profile.pownce_user and profile.pownce_password:
+ pownce_password =
get_pownce_password(settings.SECRET_KEY,profile.pownce_password,
decode=True)
+ return pownce_account_raw(profile.pownce_user, pownce_password)
def pownce_verify_credentials(account):
- try:
- pownce_account = pownce_account_raw(account.username,
account.password)
- pownce_account.get_notes(account.username)
- return True
- except:
- return False
+ try:
+ pownce_account = pownce_account_raw(account.username,
account.password)
+ pownce_account.get_notes(account.username)
+ return True
+ except:
+ return False
def get_pownce_password(key, text, decode=False):
- rand = random.Random(key).randrange
- xortext = lambda text: "".join([chr(ord(c)^rand(256)) for c in text])
- if not decode:
- text = base64.encodestring(xortext(zlib.compress(text)))
- else:
- text = zlib.decompress(xortext(base64.decodestring(text)))
- return text
+ rand = random.Random(key).randrange
+ xortext = lambda text: "".join([chr(ord(c)^rand(256)) for c in text])
+ if not decode:
+ text = base64.encodestring(xortext(zlib.compress(text)))
+ else:
+ text = zlib.decompress(xortext(base64.decodestring(text)))
+ return text
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pinax-updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---