Exemple #1
0
 def __init__(self, directories, collection):
     self.directories = directories
     self.loop_proc = None
     self.sleep_secs = 0
     self.last_change_ts = Value('i', 0)
     self.collection = Array('c', 64)
     self.collection.value = collection
     self._conf = WPConfiguration()
Exemple #2
0
def config():
    wpconf = WPConfiguration()
    if request.method == 'POST':
        for x in request.form:
            wpconf.set(x, request.form[x]) 
    return render_template('index.html', conf=wpconf)
Exemple #3
0
Fichier : t.py Projet : phowat/uowm
 def setUp(self):
     self._conf = WPConfiguration("./uowmrc-example")
Exemple #4
0
            print len(self.file_list)
            candidate = random.choice(self.file_list)
            if len(self.file_list) > self.conf.no_repeat:
                if not self.log.in_last(self.conf.no_repeat, candidate):
                    chosen = candidate
            else:
                print "This collection has less items than the no_repeat \
parameter. We cannot guarantee this."

                chosen = candidate
        self.log.add(chosen)
        return chosen


def simple_draw():
    _conn = r.connect(db='uowm')
    cur = r.table('wallpapers').\
          filter(r.row['tags'].contains("earthporn")).run(_conn)
    collection = []
    for cu in cur:
        collection.append(cu)
    print random.choice(collection)


if __name__ == '__main__':
    conf = WPConfiguration()
    a = WPDBColletion(['earthporn', 'comics'], conf, tag_match="OR")
    b = WPDBColletion(['earthporn'], conf, tag_match="AND")
    print a.draw()
    print b.draw()