2 |
2 |
3 import os |
3 import os |
4 import sys |
4 import sys |
5 import codecs |
5 import codecs |
6 import re |
6 import re |
7 |
|
8 try: |
|
9 from sanum import model |
|
10 except: |
|
11 root_dir = os.path.abspath(os.getcwd() + '/../../') |
|
12 os.chdir(root_dir) |
|
13 sys.path.append(root_dir) |
|
14 from sanum import model |
|
15 |
|
16 import sanum |
|
17 |
|
18 import turbogears |
|
19 turbogears.update_config(configfile="dev.cfg", |
|
20 modulename="sanum.config") |
|
21 |
7 |
22 |
8 |
23 from mk_scipy_paper import tex2pdf, current_dir , copy_files, preamble, \ |
9 from mk_scipy_paper import tex2pdf, current_dir , copy_files, preamble, \ |
24 render_abstract, addfile, sourcedir, outdir, outfilename |
10 render_abstract, addfile, sourcedir, outdir, outfilename |
25 |
11 |
57 addfile(outfile, sourcedir + os.sep + 'introduction.tex') |
43 addfile(outfile, sourcedir + os.sep + 'introduction.tex') |
58 |
44 |
59 #outfile.write(ur'\setcounter{page}{0}' + '\n') |
45 #outfile.write(ur'\setcounter{page}{0}' + '\n') |
60 |
46 |
61 #from sanum.controllers import Root as Controller |
47 #from sanum.controllers import Root as Controller |
62 abstracts = model.Abstract.select() |
48 # abstracts = model.Abstract.select() |
63 for abstract in abstracts: |
49 # for abstract in abstracts: |
64 if not abstract.approved: |
50 # if not abstract.approved: |
65 continue |
51 # continue |
66 print abstract.title |
52 # print abstract.title |
67 # Hack: I don't use a stringIO, because it is not unicode-safe. |
53 # # Hack: I don't use a stringIO, because it is not unicode-safe. |
68 tmpout = MyStringIO() |
54 # tmpout = MyStringIO() |
69 # Hack: I don't wont to be bound to the controller, to be |
55 # # Hack: I don't wont to be bound to the controller, to be |
70 # abstractle to run without cherrypy. |
56 # # abstractle to run without cherrypy. |
71 #attach_dir = Controller._paper_attach_dir(abstract.id) |
57 # #attach_dir = Controller._paper_attach_dir(abstract.id) |
72 attach_dir = os.path.abspath(os.sep.join( |
58 # attach_dir = os.path.abspath(os.sep.join( |
73 (os.path.dirname(sanum.__file__), 'static', |
59 # (os.path.dirname(sanum.__file__), 'static', |
74 'papers', '%i' % abstract.id))) + os.sep |
60 # 'papers', '%i' % abstract.id))) + os.sep |
75 render_abstract(tmpout, abstract) |
61 # render_abstract(tmpout, abstract) |
76 outstring = hack_include_graphics(tmpout.getvalue(), |
62 # outstring = hack_include_graphics(tmpout.getvalue(), |
77 attach_dir) |
63 # attach_dir) |
78 outfile.write(outstring) |
64 # outfile.write(outstring) |
79 #outfile.write(ur'\fillbreak' + '\n') |
65 # #outfile.write(ur'\fillbreak' + '\n') |
80 |
66 |
81 outfile.write(ur'\end{document}' + '\n') |
67 outfile.write(ur'\end{document}' + '\n') |
82 |
68 |
83 |
69 |
84 |
70 |