Skip to content

Commit

Permalink
script to (re)-generate rdf posts for all doc objects in db
Browse files Browse the repository at this point in the history
  • Loading branch information
Staffan Malmgren committed Jun 21, 2011
1 parent 72ad7ad commit 610a5a4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
17 changes: 17 additions & 0 deletions tools/generate_rdf_post_for.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
sys.path.append("..")
from django.core.management import setup_environ
from fst_web import settings
setup_environ(settings)
from fst_web.fs_doc.models import Myndighetsforeskrift, AllmannaRad, \
KonsolideradForeskrift, generate_rdf_post_for

for cls in (Myndighetsforeskrift, AllmannaRad, KonsolideradForeskrift):
for obj in cls.objects.all():
print "Generating rdf post for %s" % obj
generate_rdf_post_for(obj)



6 changes: 3 additions & 3 deletions tools/import.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,9 @@ def loaddata(directory):
fs = data['fs_doc_forfattningssamling'][int(d['forfattningssamling_id'])-1]
basefile = "%s-%s-%s" % (fs['kortnamn'],d['arsutgava'], d['lopnummer'])

if not os.path.exists("uploads/foreskrift"):
os.makedirs("uploads/foreskrift")
outfile = "uploads/foreskrift/%s.pdf" % basefile
if not os.path.exists("foreskrift"):
os.makedirs("foreskrift")
outfile = "foreskrift/%s.pdf" % basefile
shutil.copy2(pdffile,outfile)
sub_d['content'] = outfile

Expand Down

0 comments on commit 610a5a4

Please sign in to comment.