From 1b576eb4faf62064142339b3652ea26649b472e8 Mon Sep 17 00:00:00 2001 From: The Dod Date: Wed, 2 Apr 2014 00:24:32 +0700 Subject: [PATCH] Stop treating people without profile as invalids @kseistrup says "no profile" or "no avatar" is perfectly normal behavior and doesn't indicate timeout, error or sin. You're all forgiven. --- swizzler.py | 2 +- twister.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/swizzler.py b/swizzler.py index 11ce721..8b598d2 100644 --- a/swizzler.py +++ b/swizzler.py @@ -125,7 +125,7 @@ class SwizzlerApp(object): Mining the twister blockchain protects the #twister-verse from attacks like http://twister.net.co/?p=236 but unlike doge, we don't have shiny coins to offer "our protectors". Instead, they enjoy occasional minutes of fame in the form of the sponsored posts you see here. -We #Respect their their hard earned crypto-graffiti by appreciating them on coffee/spliff/soy-milk/etc. breaks, because that's how we roll yo. +We #Respect their hard earned crypto-graffiti by appreciating them on coffee/spliff/soy-milk/etc. breaks, because that's how we roll yo. Start mining today, and all this (AND moral satisfaction) can be yours.""") }, 'messages':twister.get_sponsored_posts(conf['num_messages']), diff --git a/twister.py b/twister.py index c48fcd6..a78e6af 100644 --- a/twister.py +++ b/twister.py @@ -41,7 +41,7 @@ class Twister: "reply":self._format_reply(p['userpost'].get('reply',{})), }) return result - @functioncache(ignore_instance=True) # cache forever. not supposed to change + @functioncache(60*60,ignore_instance=True) # can't cache forever, because maybe user was a skip_cache, in that case it's snafu for an hour :( def get_twist(self,username,k): p = self.twister.dhtget(username,'post{0}'.format(k),'s') if p: @@ -65,7 +65,8 @@ class Twister: return {"username":"","fullname":"Nobody"} # Username is empty. Easier for mustache. result = self.twister.dhtget(username,'profile','s') if not result: - raise SkipCache("user not found: @{0}".format(username), {"username":username,"fullname":"???"}) + #raise SkipCache("user not found: @{0}".format(username), {"username":username,"fullname":username.capitalize()}) + return {"username":username,"fullname":username.capitalize()} user = result[0]['p']['v'] user['username'] = username # handy if not user.get('fullname'): # happens @@ -77,7 +78,7 @@ class Twister: user['avatar'] = '/assets/img/genericPerson.png' except: user['avatar'] = None - raise SkipCache("couldn't get avatar for @{0}, not caching".format(username),user) + #raise SkipCache("couldn't get avatar for @{0}, not caching".format(username),user) return user @functioncache(60*5,ignore_instance=True) def local_user_menu(self,active_user=None):