Beispiel #1
0
def admin_ajax(action):
    name = request.forms.name
    try:
        Validator.check_name(name)
        p = Page(name)
        if action == 'save':
            p.content = request.forms.content
            p.save()
        elif action == 'publish':
            p.publish()
        elif action == 'remove':
            delall = bool(request.forms.delall)
            p.remove(delall)
        else:
            raise PageError('No such action')
    except PageError, e:
        return {'status': 'fail', 'data': str(e)}
Beispiel #2
0
#!/usr/bin/python

import sys
import os
from page import Page

SHOW_STEPS = True    # change this to false if you just want to see the final output for each page.
SAVE_OUTPUT = False

inputFolder = os.path.join('../images')
outputFolder = os.path.join('../output')

for filename in os.listdir(inputFolder)[:]:
#for filename in ['page332.jpg', 'page335.jpg']:
    
    inputPath = os.path.join(inputFolder, filename)
    outputPath = os.path.join(outputFolder, filename)

    page = Page(inputPath, SHOW_STEPS)
    
    if SAVE_OUTPUT:
        page.save(outputPath)  # save a copy of what is displayed. Used for getting images for the paper.
    
    page.show((800, 800))

Beispiel #3
0
#!/usr/bin/python

import sys
import os
from page import Page

SHOW_STEPS = True  # change this to false if you just want to see the final output for each page.
SAVE_OUTPUT = True

inputFolder = os.path.join('../data_BCEV2/0/testpics')
outputFolder = os.path.join('../data_BCEV2/0/output_docscrum')
# /Users/murtada/Documents/BU/Arabic NLP/data_BCEV2/0/jpg_subset
print(len(os.listdir(inputFolder)))
for filename in os.listdir(inputFolder)[:]:
    #for filename in ['page332.jpg', 'page335.jpg']:
    if filename == '.DS_Store':
        continue
    inputPath = os.path.join(inputFolder, filename)
    outputPath = os.path.join(outputFolder, filename)
    page = Page(inputPath, SHOW_STEPS)

    if SAVE_OUTPUT:
        page.save(
            outputPath
        )  # save a copy of what is displayed. Used for getting images for the paper.

    page.show((800, 800))