示例#1
0
def MobileLanguageList(request,LANG='en'):
	t=get_template('MobileLangList.html')
	LANGLIST=wikilib.getLanguageList()
	DAY, MONTH, YEAR, HOUR,expiretime,MONTHNAME = fnReturnTimes()
	PAGEDATE=str(MONTHNAME)+" "+str(DAY)+" "+str(YEAR)
	send_list=[]
	for lang in LANGLIST:
		PAGETITLE=str(wikilib.fnReturnLanguageName(lang))
		record={'LANG':str(lang),'title':PAGETITLE}
		send_list.append(record)
	PAGETITLE="Languages"
	c=Context({'PageDate':PAGEDATE,'PageTitle':PAGETITLE,'expiretime':expiretime,'language_list':send_list})
	rendered=t.render(c)
	return HttpResponse(rendered)
def splitLanguageList():
	LANGUAGES=wikilib.getLanguageList()
	L1=[]
	L2=[]
	L3=[]
	L4=[]
	COUNTER=1
	for lang in LANGUAGES:
		if COUNTER==1:
			L1.append(lang)
			COUNTER+=1
		elif COUNTER==2:
			L2.append(lang)
			COUNTER+=1
		elif COUNTER==3:
			L3.append(lang)
			COUNTER+=1
		elif COUNTER==4:
			L4.append(lang)
			COUNTER=1
	return L1,L2,L3,L4
import redis
import string 
import urllib2
from pymongo import Connection
from datetime import date
from datetime import time
from lib import wikilib
import datetime
import subprocess
import syslog
import os

conn=Connection('10.164.95.114')
db=conn.wc

LANGUAGES=wikilib.getLanguageList()

Cli=redis.Redis('localhost')


send_list=[]

for lang in LANGUAGES:
	collNAME=str(lang)+'_threehour'
	keyNAME=str(lang)+'_THREEHOUR'
	THREEHOUR_QUERY=db[collNAME].find().sort('place',1)
	PLACEMENT=0
	for p in THREEHOUR_QUERY:
		PLACEMENT+=1
		tstr=str(p['title'])
		REDIS_TITLE_KEY=str(lang)+'_'+str(PLACEMENT)+'_'+'TITLE'
示例#4
0
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
from lib import wikilib

LANGS= wikilib.getLanguageList()
PATHS=['action','staging','ondeck']
for lang in LANGS:
	for path in PATHS:
		DIRMAKE="/tmp/"+str(lang)+"_"+str(path)
		if not os.path.exists(DIRMAKE):
			os.makedirs(DIRMAKE)

os.makedirs('/tmp/staging/')