borrowing books functionality.. done

This commit is contained in:
crunk 2021-04-17 18:16:44 +02:00
parent dc1e3ce99f
commit 6fe2cda71a
2 changed files with 75 additions and 56 deletions

View File

@ -1,6 +1,7 @@
"""This parses the varlib.csv but only in a way """This parses the varlib.csv but only in a way
that is actually useful for the site""" that is actually useful for the site"""
from tempfile import NamedTemporaryFile
import shutil
import csv import csv
import os import os
@ -170,8 +171,8 @@ def writepublication(uploadform):
os.path.join(script_dir, "varlib.csv"), os.path.join(script_dir, "varlib.csv"),
'a', 'a',
newline='') as csvfile: newline='') as csvfile:
writer = csv.DictWriter(csvfile, fieldnames=fieldnames) csv_as_writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writerow( csv_as_writer.writerow(
{ {
"Id": id, "Id": id,
"Publication": uploadform.uploadpublication.data, "Publication": uploadform.uploadpublication.data,
@ -189,3 +190,21 @@ def writepublication(uploadform):
}) })
print("succesfully written book to csv") print("succesfully written book to csv")
return id return id
def editborrowedby(pubid, borrower):
tempfile = NamedTemporaryFile('w+t', newline='', delete=False)
filename = os.path.join(script_dir, "varlib.csv")
with open(filename, 'r', newline='') as libcsv, tempfile:
csv_as_dict = csv.DictReader(libcsv)
csv_as_writer = csv.DictWriter(tempfile, fieldnames=fieldnames)
#use the reader to read where, then writer to write the new row.
csv_as_writer.writeheader()
for row in csv_as_dict:
if pubid == row["Id"]:
print("publication changes borrower")
print(row["Publication"])
row["Currently borrowed by"] = borrower
csv_as_writer.writerow(row)
shutil.move(tempfile.name, filename)

View File

@ -1,5 +1,5 @@
Id,Publication,Author,Year,Custodian,Fields,Type,Publishers,License,LicenseShort,Highlights,Comments,Currently borrowed by Id,Publication,Author,Year,Custodian,Fields,Type,Publishers,License,LicenseShort,Highlights,Comments,Currently borrowed by
1,The Economics of Anarchism,Anarcho,2012,Varia,"Economics, Anarchism",Zine,theanarchistlibrary.org,Anti-copyright,Anti-copyright,"The labourer retains, even after he has recieved his wages, a natural right in the thing he has produced",, 1,The Economics of Anarchism,Anarcho,2012,Varia,"Economics, Anarchism",Zine,theanarchistlibrary.org,Anti-copyright,Anti-copyright,"The labourer retains, even after he has recieved his wages, a natural right in the thing he has produced",,No one
2,Identity Politics - An Anthology,The Anarchist Library,,Varia,Identity politics,Zine,Paper Jam Collective,No license mentioned,No license mentioned,,me, 2,Identity Politics - An Anthology,The Anarchist Library,,Varia,Identity politics,Zine,Paper Jam Collective,No license mentioned,No license mentioned,,me,
3,The mythology of work,CrimeThinc.com,,Varia,"Work, Anticapitalism",Zine,CrimeThinc.com,No license mentioned,No license mentioned,,"A selection from 'Work', a 376-page analysis of contemporary capitalism", 3,The mythology of work,CrimeThinc.com,,Varia,"Work, Anticapitalism",Zine,CrimeThinc.com,No license mentioned,No license mentioned,,"A selection from 'Work', a 376-page analysis of contemporary capitalism",
4,Forget Shorter Showers - Why Personal Change Does Not Equal Political Change,Derrick Jensen,2009,Varia,Environmental justice,Zine,,No license mentioned,No license mentioned,Green consumerism isn't enough.,, 4,Forget Shorter Showers - Why Personal Change Does Not Equal Political Change,Derrick Jensen,2009,Varia,Environmental justice,Zine,,No license mentioned,No license mentioned,Green consumerism isn't enough.,,
@ -10,7 +10,7 @@ Id,Publication,Author,Year,Custodian,Fields,Type,Publishers,License,LicenseShort
9,To Boldly Go: a starters guide to hand made and diy films,Film Werkplaats Worm Rotterdam,2008,Varia,"Experimental film, Analog film, DIY, Hand-made",Paperback,Knust (Nijmegen),'No license mentioned,No license mentioned,,, 9,To Boldly Go: a starters guide to hand made and diy films,Film Werkplaats Worm Rotterdam,2008,Varia,"Experimental film, Analog film, DIY, Hand-made",Paperback,Knust (Nijmegen),'No license mentioned,No license mentioned,,,
10,Anarchism: Basic concepts and ideas,Peter Storm,2018,Varia,"Anarchism, Dutch Theory",Zine,Ravotr Editions in collaboration with Paper Jam,Feel free to use and copy this text as you see fit. Mentioning source and author would be greatly appreciated.,No license mentioned,,Revised text of a transcribed lecture Storm gave in Rotterdam., 10,Anarchism: Basic concepts and ideas,Peter Storm,2018,Varia,"Anarchism, Dutch Theory",Zine,Ravotr Editions in collaboration with Paper Jam,Feel free to use and copy this text as you see fit. Mentioning source and author would be greatly appreciated.,No license mentioned,,Revised text of a transcribed lecture Storm gave in Rotterdam.,
11,Queering Anarchism,"Deric Shannon, Abbey Willis",,Varia,"Anarchism, Queer Theory",Zine,Paper Jam Collective,No license mentioned,No license mentioned,,, 11,Queering Anarchism,"Deric Shannon, Abbey Willis",,Varia,"Anarchism, Queer Theory",Zine,Paper Jam Collective,No license mentioned,No license mentioned,,,
12,Abolish restaurants,Prole.info,2010,Varia,"Labour, Food industry",Paperback,Pm Press,Copyright 2010,Copyright,Drawing on a range of anti-capitalist ideas as well as a heaping plate of personal experience,, 12,Abolish restaurants,Prole.info,2010,Varia,"Labour, Food industry",Paperback,Pm Press,Copyright 2010,Copyright,Drawing on a range of anti-capitalist ideas as well as a heaping plate of personal experience,,CCL
13,"Elk Woord Een Vonk: Verboden Teksten, verwerpelijke vervolging: de zaak Joke Kaviaar",Steungroep 13 September,2014,Varia (or Luke?),"Joke Kaviaar, Immigration, Activism, Forbidden Texts, Incarceration",Softcover,Self-published,Copyleft,Copyleft,,https://13-september.nl, 13,"Elk Woord Een Vonk: Verboden Teksten, verwerpelijke vervolging: de zaak Joke Kaviaar",Steungroep 13 September,2014,Varia (or Luke?),"Joke Kaviaar, Immigration, Activism, Forbidden Texts, Incarceration",Softcover,Self-published,Copyleft,Copyleft,,https://13-september.nl,
14,A NO BORDERS manifesto,Ill Will Editions,2015,Varia,Migrant justice,Zine,Self-published,No license mentioned,No license mentioned,,, 14,A NO BORDERS manifesto,Ill Will Editions,2015,Varia,Migrant justice,Zine,Self-published,No license mentioned,No license mentioned,,,
16,Futur Musique,De fanfare voor vooruit strevende volksmuziek,2018,Varia,"Musical Instruments, DIY",Zine,Self-published,No license mentioned,No license mentioned,Copied instructions on building one's own musical instruments,, 16,Futur Musique,De fanfare voor vooruit strevende volksmuziek,2018,Varia,"Musical Instruments, DIY",Zine,Self-published,No license mentioned,No license mentioned,Copied instructions on building one's own musical instruments,,
@ -23,7 +23,7 @@ Id,Publication,Author,Year,Custodian,Fields,Type,Publishers,License,LicenseShort
23,The Moral of the Xerox,"Florian Cramer, Clara Lobregat Balaguer",2017,Varia,"Piracy, Cultural Appropriation",Zine,Self-published,No license mentioned,No license mentioned,"Printed in diocese of Cologne, Germany on the joyous occasion of the Pluriversale VII: Stealing from the west for the critical parishioners of Akademie der Kunste der Welt",, 23,The Moral of the Xerox,"Florian Cramer, Clara Lobregat Balaguer",2017,Varia,"Piracy, Cultural Appropriation",Zine,Self-published,No license mentioned,No license mentioned,"Printed in diocese of Cologne, Germany on the joyous occasion of the Pluriversale VII: Stealing from the west for the critical parishioners of Akademie der Kunste der Welt",,
24,Non-Western Anarchisms,Jason Adams,,Varia,Non-Western Anarchisms,Zine,Zaba Books,No license mentioned,No license mentioned,"The purpose of this paper is to help anarchist/anti-authoritarian movements active today to reconceptualise the history and theory of first-wave anarchism on the global level, and to reconsider its relevance to the continuing anarchist project.",, 24,Non-Western Anarchisms,Jason Adams,,Varia,Non-Western Anarchisms,Zine,Zaba Books,No license mentioned,No license mentioned,"The purpose of this paper is to help anarchist/anti-authoritarian movements active today to reconceptualise the history and theory of first-wave anarchism on the global level, and to reconsider its relevance to the continuing anarchist project.",,
33,The immaterial labor union #7: immersive advertisement,Lídia Pereira and Δεριζαματζορ Προμπλεμ ιναυστραλια,,Varia,"labour, Advertisement, immersion, social media",Zine,Self-published,Zine is published under Gnu free documentation license 1.3 unless otherwise specified ,GNU Free Documentation License,,, 33,The immaterial labor union #7: immersive advertisement,Lídia Pereira and Δεριζαματζορ Προμπλεμ ιναυστραλια,,Varia,"labour, Advertisement, immersion, social media",Zine,Self-published,Zine is published under Gnu free documentation license 1.3 unless otherwise specified ,GNU Free Documentation License,,,
34,The immateriality labor union #10: immateriality,Lídia Pereira and Δεριζαματζορ Προμπλεμ ιναυστραλια,2017,Varia,"Labour, Immateriality",Zine,Self-published,GNU Free Documentation License,GNU Free Documentation License,,, 34,The immateriality labor union #10: immateriality,Lídia Pereira and Δεριζαματζορ Προμπλεμ ιναυστραλια,2017,Varia,"Labour, Immateriality",Zine,Self-published,GNU Free Documentation License,GNU Free Documentation License,,,Danny
35,The immaterial labor union. Special Issue #1: Homebrew Server Club,Homebrew Server Club,2017,Varia,"Self-Hosting, Servers, DIY",Zine,Self-published,CC-BY-SA,Creative commons,,, 35,The immaterial labor union. Special Issue #1: Homebrew Server Club,Homebrew Server Club,2017,Varia,"Self-Hosting, Servers, DIY",Zine,Self-published,CC-BY-SA,Creative commons,,,
36,Pervasive labour union. Special issue #2: The Entreprecariat,Silvio Lorusso,2017,Varia,"Entreprecariat, Labour, Precarity",Zine,Self-published,No license mentioned,No license mentioned,,Between April and May 2017 the Zine's name changed from Immaterial Labor Union to Pervasive Labour Union, 36,Pervasive labour union. Special issue #2: The Entreprecariat,Silvio Lorusso,2017,Varia,"Entreprecariat, Labour, Precarity",Zine,Self-published,No license mentioned,No license mentioned,,Between April and May 2017 the Zine's name changed from Immaterial Labor Union to Pervasive Labour Union,
37,'Pervasive labour union #13: Fed Up,Lídia Pereira,2019,Varia,"Labour, DIY, federation",Zine,Self-published,"GNU Free Documentation License 1.3, CC-0, Copyright (C) 2019, Julia Janssen, Peer Production License",GNU Free Documentation License,,, 37,'Pervasive labour union #13: Fed Up,Lídia Pereira,2019,Varia,"Labour, DIY, federation",Zine,Self-published,"GNU Free Documentation License 1.3, CC-0, Copyright (C) 2019, Julia Janssen, Peer Production License",GNU Free Documentation License,,,

1 Id Publication Author Year Custodian Fields Type Publishers License LicenseShort Highlights Comments Currently borrowed by
2 1 The Economics of Anarchism Anarcho 2012 Varia Economics, Anarchism Zine theanarchistlibrary.org Anti-copyright Anti-copyright The labourer retains, even after he has recieved his wages, a natural right in the thing he has produced No one
3 2 Identity Politics - An Anthology The Anarchist Library Varia Identity politics Zine Paper Jam Collective No license mentioned No license mentioned me
4 3 The mythology of work CrimeThinc.com Varia Work, Anticapitalism Zine CrimeThinc.com No license mentioned No license mentioned A selection from 'Work', a 376-page analysis of contemporary capitalism
5 4 Forget Shorter Showers - Why Personal Change Does Not Equal Political Change Derrick Jensen 2009 Varia Environmental justice Zine No license mentioned No license mentioned Green consumerism isn't enough.
10 9 To Boldly Go: a starters guide to hand made and diy films Film Werkplaats Worm Rotterdam 2008 Varia Experimental film, Analog film, DIY, Hand-made Paperback Knust (Nijmegen) 'No license mentioned No license mentioned
11 10 Anarchism: Basic concepts and ideas Peter Storm 2018 Varia Anarchism, Dutch Theory Zine Ravotr Editions in collaboration with Paper Jam Feel free to use and copy this text as you see fit. Mentioning source and author would be greatly appreciated. No license mentioned Revised text of a transcribed lecture Storm gave in Rotterdam.
12 11 Queering Anarchism Deric Shannon, Abbey Willis Varia Anarchism, Queer Theory Zine Paper Jam Collective No license mentioned No license mentioned
13 12 Abolish restaurants Prole.info 2010 Varia Labour, Food industry Paperback Pm Press Copyright 2010 Copyright Drawing on a range of anti-capitalist ideas as well as a heaping plate of personal experience CCL
14 13 Elk Woord Een Vonk: Verboden Teksten, verwerpelijke vervolging: de zaak Joke Kaviaar Steungroep 13 September 2014 Varia (or Luke?) Joke Kaviaar, Immigration, Activism, Forbidden Texts, Incarceration Softcover Self-published Copyleft Copyleft https://13-september.nl
15 14 A NO BORDERS manifesto Ill Will Editions 2015 Varia Migrant justice Zine Self-published No license mentioned No license mentioned
16 16 Futur Musique De fanfare voor vooruit strevende volksmuziek 2018 Varia Musical Instruments, DIY Zine Self-published No license mentioned No license mentioned Copied instructions on building one's own musical instruments
23 23 The Moral of the Xerox Florian Cramer, Clara Lobregat Balaguer 2017 Varia Piracy, Cultural Appropriation Zine Self-published No license mentioned No license mentioned Printed in diocese of Cologne, Germany on the joyous occasion of the Pluriversale VII: Stealing from the west for the critical parishioners of Akademie der Kunste der Welt
24 24 Non-Western Anarchisms Jason Adams Varia Non-Western Anarchisms Zine Zaba Books No license mentioned No license mentioned The purpose of this paper is to help anarchist/anti-authoritarian movements active today to reconceptualise the history and theory of first-wave anarchism on the global level, and to reconsider its relevance to the continuing anarchist project.
25 33 The immaterial labor union #7: immersive advertisement Lídia Pereira and Δεριζαματζορ Προμπλεμ ιναυστραλια Varia labour, Advertisement, immersion, social media Zine Self-published Zine is published under Gnu free documentation license 1.3 unless otherwise specified GNU Free Documentation License
26 34 The immateriality labor union #10: immateriality Lídia Pereira and Δεριζαματζορ Προμπλεμ ιναυστραλια 2017 Varia Labour, Immateriality Zine Self-published GNU Free Documentation License GNU Free Documentation License Danny
27 35 The immaterial labor union. Special Issue #1: Homebrew Server Club Homebrew Server Club 2017 Varia Self-Hosting, Servers, DIY Zine Self-published CC-BY-SA Creative commons
28 36 Pervasive labour union. Special issue #2: The Entreprecariat Silvio Lorusso 2017 Varia Entreprecariat, Labour, Precarity Zine Self-published No license mentioned No license mentioned Between April and May 2017 the Zine's name changed from Immaterial Labor Union to Pervasive Labour Union
29 37 'Pervasive labour union #13: Fed Up Lídia Pereira 2019 Varia Labour, DIY, federation Zine Self-published GNU Free Documentation License 1.3, CC-0, Copyright (C) 2019, Julia Janssen, Peer Production License GNU Free Documentation License