Example #1
0
def seed_db():
    load_styles("datasets/styleguide.xml")
    load_hops("datasets/hops.xml")
    load_extracts("datasets/adjuncts.xml")
    load_extracts("datasets/extracts.xml")
    load_misc("datasets/special.xml")
    load_yeasts("datasets/yeast.xml")
    load_ferms("datasets/grains.xml")
    load_recipes("datasets/recipe.xml")
Example #2
0
def seed_db():
    load_user()
    load_styles("datasets/styleguide.xml")
    load_hops("datasets/hops.xml")
    load_extracts("datasets/adjuncts.xml")
    load_extracts("datasets/extracts.xml")
    load_misc("datasets/special.xml")
    load_yeasts("datasets/yeast.xml")
    load_ferms("datasets/grains.xml")
    load_recipes("datasets/recipe.xml")
Example #3
0
        def save_files(newfile):
            if newfile and allowed_file(newfile.filename):
                filename = secure_filename(newfile.filename)
                newfile.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
                filepath = "tmp/uploads/" + filename

                status, name = load_recipes(filepath, session["user_id"], share)
                if status == "error":
                    error_names.append(name)
                else:
                    recipes.append(name)
Example #4
0
        def save_files(newfile):
            if newfile and allowed_file(newfile.filename):
                filename = secure_filename(newfile.filename)
                newfile.save(
                    os.path.join(app.config['UPLOAD_FOLDER'], filename))
                filepath = "tmp/uploads/" + filename

                status, name = load_recipes(filepath, session["user_id"],
                                            share)
                if status == "error":
                    error_names.append(name)
                else:
                    recipes.append(name)
Example #5
0
        if e.text is not None:
            substr = (e.text)
            r.append(substr)
        if e.tail is not None:
            tailstr = (e.tail)
            r.append(e.tail)
    alltext = ' '.join(r)

    # Clean up the joined text fragments
    # Remove any line endings
    alltext = re.sub(endline_patt, "", alltext)
    # Remove extra whitespace
    alltext = re.sub(doublespace_patt, "", alltext)

    return alltext

########################################################################

if __name__ == "__main__":
    connect_to_db(app)
    db.create_all()

    load_styles("datasets/styleguide.xml")
    load_hops("datasets/hops.xml")
    load_extracts("datasets/adjuncts.xml")
    load_extracts("datasets/extracts.xml")
    load_misc("datasets/special.xml")
    load_yeasts("datasets/yeast.xml")
    load_ferms("datasets/grains.xml")
    load_recipes("datasets/recipe.xml")
Example #6
0
 def test_upload(self):
     self.assertEqual(feeder.load_recipes("olddata/samplerecipe.xml"), ("success", "Tester Recipe"))