def post_message(): user = get_logged_in_user() if user is None: return template('login', null=None) text = request.forms.get('text', '') if text: pubsub.post_message(user, text) return show_main_page(user)
def post_message(): user = get_logged_in_user() if user is None: return template('login', null=None) text = request.forms.get('text', '') if text: pubsub.post_message(user, text) return show_main_page(user)
def post_message() -> None: user = get_logged_in_user() if user is None: return template("login", null=None) text = request.forms.get("text", "") if text: pubsub.post_message(user, text) return show_main_page(user)
bio='English writer, poet, philologist, and university professor', photo='jrr.jpg') set_user('rene', displayname='René Descartes', password='******', email='*****@*****.**', bio='French philosopher, mathematician, and scientist', photo='rene.jpg') set_user('anais', displayname='Anaïs Nin', password='******', email='*****@*****.**', bio='American diarist, essayist, novelist, and writer of short stories and erotica', photo='anais.jpg') set_user('kongzi', displayname='Confucius', password='******', email='*****@*****.**', bio='Chinese teacher, editor, politician, and philosopher', photo='confucius.jpg') set_user('albert', displayname='Albert Einstein', password='******', email='*****@*****.**', bio='German-born theoretical physicist who developed the theory of relativity', photo='einstein.jpg') set_user('gsantayana', displayname='George Santayana', password='******', email='*****@*****.**', bio='Prolific 20th-century Spanish philosopher', photo='gsantayana.jpg') now = time() post_message('oscar', 'Work is the curse of the drinking classes') post_message('jrr', 'Not all those who wander are lost.') post_message('rene', 'There is nothing so strange and so unbelievable that it has been said by one philosopher or another.') post_message('anais', "We don't see things as they are, we see them as we are.") post_message('kongzi', 'To study and not think is a waste. To think and not study is dangerous.') post_message('kongzi', 'What you do not want done to yourself, do not do to others.') post_message('kongzi', 'Is it not a joy to have friends come from afar?') post_message('kongzi', 'The things which men greatly desire are comprehended in meat and drink and sexual pleasure.') post_message('albert', 'Insanity is repeating the same mistakes and expecting different results.') post_message('albert', 'Experts are just trained dogs.') post_message('gsantayana', 'Those who cannot remember the past are condemened to repeat it.') follow('oscar', followed_user='******') follow('oscar', followed_user='******') follow('oscar', followed_user='******') follow('kongzi', followed_user='******')
password='******', email='*****@*****.**', bio='Popeye!', photo='popeye.jpg', ) set_user( 'homer', display_name='Homer Simpson', password='******', email='*****@*****.**', bio='Husband of Marge Simpson.', photo='homer.jpg', ) now = time() post_message('felix', '#python tip: use named tuples', now - 3600 * 48) post_message('felix', '#python tip: develop interactively', now - 500) post_message('popeye', 'gradient descent save me money on travel', now - 2500) post_message('popeye', 'join a band today', now - 3600) post_message('homer', 'Donuts?', now - 80) post_message('homer', 'Anybody here?', now - 50) post_message('homer', 'have you ever wanted to unpack mappings?', now - 46) follow('felix', followed_user='******') follow('felix', followed_user='******') follow('homer', followed_user='******') follow('homer', followed_user='******') follow('popeye', followed_user='******') if __name__ == '__main__': from pubsub import posts, followers, following, user_info
photo='barry_warsaw.jpg') set_user('davin', displayname='Davin Potts', password='******', email='*****@*****.**', bio='Chemist, Teacher, Father', photo='davin-potts-200.png') set_user('selik', displayname='Michael Selik', password='******', email='*****@*****.**', bio='All problems are data science problems', photo='selik.jpg') now = time() post_message('raymondh', '#python tip: use named tuples', now - 3600 * 48) post_message('barry', 'join a band today', now - 3600) post_message('selik', 'gradient descent save me money on travel', now - 2500) post_message('raymondh', '#python tip: develop interactively', now - 500) post_message('barry', 'learn emacs', now - 80) post_message('davin', '@raymondh teaching #python today', now - 50) post_message('selik', 'have you ever wanted to unpack mappings?', now - 46) post_message('raymondh', '#python tip: have fun programming', now - 40) post_message('davin', '#camping tip: always take water', now - 30) post_message('barry', 'enums rock', now - 20) post_message('raymondh', '#python tip: never mutate while iterating', now - 10) post_message('davin', 'coriander and cilantro come from the same plant', now) follow('davin', followed_user='******') follow('davin', followed_user='******') follow('selik', followed_user='******')
from pubsub import set_user, post_message, follow from pprint import pprint from time import time set_user('raymondh', displayname='Raymond Hettinger', password='******', email='*****@*****.**', bio='Former fashion photographer', photo='raymond.jpg') set_user('barry', displayname='Barry Warsaw', password='******', email='*****@*****.**', bio='Plays in a band', photo='barry_warsaw.jpg') set_user('davin', displayname='Davin Potts', password='******', email='*****@*****.**', bio='Chemist, Teacher, Father', photo='davin-potts-200.png') set_user('selik', displayname='Michael Selik', password='******', email='*****@*****.**', bio='All problems are data science problems', photo='selik.jpg') now = time() post_message('raymondh', '#python tip: use named tuples', now-3600*48) post_message('barry', 'join a band today', now-3600) post_message('selik', 'gradient descent save me money on travel', now-2500) post_message('raymondh', '#python tip: develop interactively', now-500) post_message('barry', 'learn emacs', now-80) post_message('davin', 'teaching #python today', now-50) post_message('selik', 'have you ever wanted to unpack mappings?', now-46) post_message('raymondh', '#python tip: have fun programming', now-40) post_message('davin', '#camping tip: always take water', now-30) post_message('barry', 'enums rock', now-20) post_message('raymondh', '#python tip: never mutate while iterating', now-10) post_message('davin', 'coriander and cilantro come from the same plant', now) follow('davin', followed_user='******') follow('davin', followed_user='******') follow('selik', followed_user='******')
password="******", email="*****@*****.**", bio="Chemist, Teacher, Father", photo="davin-potts-200.png", ) set_user( "selik", displayname="Michael Selik", password="******", email="*****@*****.**", bio="All problems are data science problems", photo="selik.jpg", ) now = time() post_message("raymondh", "#python tip: use named tuples", now - 3600 * 48) post_message("barry", "join a band today", now - 3600) post_message("selik", "gradient descent save me money on travel", now - 2500) post_message("raymondh", "#python tip: develop interactively", now - 500) post_message("barry", "learn emacs", now - 80) post_message("davin", "@raymondh teaching #python today", now - 50) post_message("selik", "have you ever wanted to unpack mappings?", now - 46) post_message("raymondh", "#python tip: have fun programming", now - 40) post_message("davin", "#camping tip: always take water", now - 30) post_message("barry", "enums rock", now - 20) post_message("raymondh", "#python tip: never mutate while iterating", now - 10) post_message("davin", "coriander and cilantro come from the same plant", now) follow("davin", followed_user="******") follow("davin", followed_user="******") follow("selik", followed_user="******")