Ejemplo n.º 1
0
import base64
import os
import random
import time

from auto_tagify import AutoTagify
from boto.s3.key import Key
from PIL import Image
from pymongo import DESCENDING
from pymongo.objectid import ObjectId

import settings

CONTENT_TYPE = 'image/jpeg'
ATAG = AutoTagify()
ATAG.link = "/tag"
RECENT_LIMIT = 12


class Snappy(object):
    """All the snapshot functionality"""
    def __init__(self):
        self.token = ''
        self.env = 'dev'
        self.db = settings.DATABASE

    def set_environment(self, env='dev'):
        if env == 'test':
            self.env = env
            self.db = settings.TEST_DATABASE
    
Ejemplo n.º 2
0
import urllib
import math
import re
import web
from web import session
from datetime import datetime
from redis import Redis
from auto_tagify import AutoTagify

tag = AutoTagify()
tag.link = '/tags'
clean_word = re.compile('[\[\],().:"\'?!*<>/\+={}`~\n\r\t]')
clean_quotes = re.compile('(%27)|()')
r = Redis()
record_max_length = 50

class TapeChatTag(object):
  def __init__(self):
    self.all_entries = ''
    self.next_page = 1
    self.prev_page = 0
    self.page_value = 0
    self.start_pos = 0
    self.text_entries = ''  
    
  def generate(self,user_id):
    if self.next_page < 0: self.next_page = 0
    if self.prev_page < 0: self.prev_page = 0
    if self.page_value < 0: self.page_value = 0
     
    try: