示例#1
0
文件: admin.py 项目: adi69/MySite
 def save_model(self, request, obj, form, change):
     
     content_unicoded = obj.content.encode('ascii','ignore')
     d = highlights(content_unicoded)
     obj.save()
     
     for item in d:
         hl = HL.objects.filter(name=str(item)).filter(blog=obj)
         if not hl:
             HL.objects.create(name=str(item), blog=obj)
示例#2
0
  votestatus()

# ANNOUNCES SHOW, LOGS ANNOUNCING TWEET'S ID

if sys.argv[1] == "startshow":
  startshow()

# ANNOUNCES END OF SHOW, LOGS THAT TWEET ID IN voters.log, AND PROCESSES TWEETS FOR HIGHLIGHTS

if sys.argv[1] == "endshow":
  endshow()

# HANDLES RETWEETING HIGHLIGHTS FROM LAST WEEK'S EVENT

if sys.argv[1] == "highlights":
  highlights()

# REMINDER TO VOTE IF YOU HAVEN'T YET ON THE LAST DAY

if sys.argv[1] == "votereminder":
  subprocess.call(['/usr/local/bin/t','update',"Today's the LAST CHANCE TO VOTE for an episode. Polls close at 8:30 pm ET tonight! Current tally: http://nategri.github.io/tweetTrek/votes.html"])

# FIRST REMINDER

if sys.argv[1] == "reminder1":
  status = "Tomorrow night at 9pm ET we're watching "+winner()+". Join us!"
  subprocess.call(['/usr/local/bin/t','update',status])

# SECOND REMINDER

if sys.argv[1] == "reminder2":
示例#3
0
import highlights
import re
print('=====WELCOME TO LIVE CRICKET UPDATES======')
print('TODAYS MATCHES ARE -')
t = 0
matches = availaible_matches.get_ids()
for i in list(matches.keys()):
    q = re.sub('-', ' ', i)
    print('[' + str(t) + ']', q.upper())
    t = t + 1
rspnce = int(input('Enter the appropriate number \n'))
if (rspnce > len(matches.keys())):
    print(' Number out of range')
    raise ValueError('Number out of range')
else:
    mtchid = list(matches.values())[rspnce]
print(mtchid)
print('The following types of updates are possible')
print('[0] full commentary')
print('[1] highlights')
print('[2] score')
subrsp = int(input('Enter the suitable choice \n'))
if (subrsp > 2):
    raise ValueError('Number out of range')
    print(' Number out of range \n')
if subrsp == 0:
    fullcmntry.fllcmntry(mtchid)
if subrsp == 1:
    highlights.highlights(mtchid)
if subrsp == 2:
    score.score1(mtchid)