Changeset 165:6811f8d6cb25
- Timestamp:
- 08/23/07 15:23:15 (14 months ago)
- Author:
- mercurial@…
- Message:
-
merge
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r142
|
r165
|
|
| 5 | 5 | from StringIO import StringIO |
| 6 | 6 | |
| 7 | | logging.basicConfig(level=logging.DEBUG, |
| 8 | | format='%(asctime)s %(levelname)s %(message)s', |
| 9 | | filename='cached.log', |
| 10 | | filemode='w') |
| | 7 | #logging.basicConfig(level=logging.DEBUG, |
| | 8 | # format='%(asctime)s %(levelname)s %(message)s', |
| | 9 | # filename='cached.log', |
| | 10 | # filemode='w') |
| 11 | 11 | |
| 12 | 12 | console = logging.StreamHandler() |
-
|
r139
|
r165
|
|
| 27 | 27 | def _new_size(image, width, height, scale): |
| 28 | 28 | """calculate new size""" |
| | 29 | if width == -1: |
| | 30 | width = None |
| | 31 | if height == -1: |
| | 32 | height = None |
| 29 | 33 | img_width, img_height = image.size |
| 30 | 34 | if width is None and height is None and scale is None: |
| 31 | 35 | return image.size |
| | 36 | |
| | 37 | if width is not None and height is not None: |
| | 38 | return width, height |
| 32 | 39 | |
| 33 | 40 | if width is not None or height is not None: |
| … |
… |
|
| 49 | 56 | width, height = _new_size(image, width, height, scale) |
| 50 | 57 | |
| 51 | | image.thumbnail((width, height), Image.ANTIALIAS) |
| | 58 | #image.thumbnail((width, height), Image.ANTIALIAS) |
| | 59 | #image.resize((width, height), Image.ANTIALIAS) |
| | 60 | image.load() |
| | 61 | image = image._new(image.im.stretch((width, height), Image.NEAREST)) |
| 52 | 62 | |
| 53 | 63 | data = StringIO() |
-
|
r140
|
r165
|
|
| 11 | 11 | |
| 12 | 12 | |
| 13 | | logging.basicConfig(level=logging.DEBUG, |
| 14 | | format='%(asctime)s %(levelname)s %(message)s', |
| 15 | | filename=os.path.join(curdir, 'mailer.log'), |
| 16 | | filemode='w') |
| | 13 | #logging.basicConfig(level=logging.DEBUG, |
| | 14 | # format='%(asctime)s %(levelname)s %(message)s', |
| | 15 | # filename=os.path.join(curdir, 'mailer.log'), |
| | 16 | # filemode='w') |
| 17 | 17 | |
| 18 | 18 | console = logging.StreamHandler() |
-
|
r147
|
r165
|
|
| 1 | 1 | |
| 2 | 2 | DATABASE = 'postgres://chainon:chainon@localhost/chainon' |
| 3 | | SMTP_SERVER = 'smtp.neuf.fr' |
| | 3 | SMTP_SERVER = 'localhost' |
| 4 | 4 | |
-
|
r133
|
r165
|
|
| 1 | 1 | |
| 2 | | db = 'postgres://chainon:chainon@localhost/chainon' |
| | 2 | db = 'postgres://chainon:chainon@localhost/chainon_fr' |
| 3 | 3 | |
| 4 | 4 | tag_retriever = 'select label from items_tag' |
-
|
r130
|
r165
|
|
| 13 | 13 | |
| 14 | 14 | def compute(): |
| 15 | | |
| 16 | 15 | # tags |
| 17 | 16 | tags = [res[0] for res in query(tag_retriever)] |
-
|
r140
|
r165
|
|
| 12 | 12 | logging.basicConfig(level=logging.DEBUG, |
| 13 | 13 | format='%(asctime)s %(levelname)s %(message)s', |
| 14 | | filename=os.path.join(curdir, 'xap.log'), |
| 15 | | filemode='w') |
| | 14 | filename=os.path.join(curdir, '/home/tarek/data/xap.log'), |
| | 15 | filemode='a') |
| 16 | 16 | |
| 17 | 17 | console = logging.StreamHandler() |
| … |
… |
|
| 26 | 26 | if len(sys.argv) > 1: |
| 27 | 27 | settings.SQLURI = sys.argv[1] |
| 28 | | |
| 29 | 28 | from xapindexer import start_server |
| 30 | 29 | from xapindexer import stop_server |
| 31 | 30 | |
| 32 | 31 | logging.debug('running xapian server') |
| 33 | | start_server() |
| 34 | | |
| | 32 | try: |
| | 33 | start_server() |
| | 34 | except Exception, e: |
| | 35 | logging.debug('failed to start %s' % str(e)) |
| | 36 | raise e |
| | 37 | |
| 35 | 38 | while True: |
| 36 | 39 | try: |
-
|
r148
|
r165
|
|
| 5 | 5 | from tokenizer import tokenize |
| 6 | 6 | from settings import DB_FILE |
| | 7 | |
| | 8 | curdir = os.path.dirname(__file__) |
| | 9 | if curdir == '': |
| | 10 | curdir = '.' |
| | 11 | |
| | 12 | curdir = os.path.realpath(curdir) |
| | 13 | |
| | 14 | logging.basicConfig(level=logging.DEBUG, |
| | 15 | format='%(asctime)s %(levelname)s %(message)s', |
| | 16 | filename=os.path.join(curdir, '/home/tarek/data/xap.log'), |
| | 17 | filemode='a') |
| 7 | 18 | |
| 8 | 19 | def read_only(): |
| … |
… |
|
| 40 | 51 | """search""" |
| 41 | 52 | logging.debug('searching for "%s"' % query) |
| 42 | | |
| | 53 | logging.debug('opening db file in read mode') |
| 43 | 54 | db = read_only() |
| | 55 | logging.debug('db file in read mode opened') |
| 44 | 56 | query = tokenize([query]) |
| 45 | 57 | enquire = xapian.Enquire(db) |
-
|
r148
|
r165
|
|
| 6 | 6 | curdir = os.path.realpath(curdir) |
| 7 | 7 | |
| 8 | | DB_FILE = os.path.join(curdir, 'data', 'chainon.xap') |
| | 8 | #DB_FILE = os.path.join(curdir, 'data', 'chainon.xap') |
| | 9 | |
| | 10 | DB_FILE = '/home/tarek/data' |
| 9 | 11 | |
| 10 | 12 | SQLURI = 'postgres://chainon:chainon@localhost/chainon' |