Trees | Indices | Help |
---|
|
1 #!/bin/env python 2 # This Python file uses the following encoding=utf-8 3 4 # Amo - Allgemeine Modulare Objektverwaltung im lesbaren YAML Format 5 # Copyright © 2007 - 2007 Arne Babenhauserheide 6 7 # This program is free software; you can redistribute it and/or modify 8 # it under the terms of the GNU General Public License as published by 9 # the Free Software Foundation; either version 2 of the License, or 10 # (at your option) any later version. 11 12 # This program is distributed in the hope that it will be useful, 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU General Public License for more details. 16 17 # You should have received a copy of the GNU General Public License 18 # along with this program; if not, write to the Free Software 19 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, 20 # MA 02110-1301 USA 21 22 # Dieses Skript übersetzt tag-IDs zu Dateien. 23 24 # Als Eingabe erhalten wir eine tag-ID im Format 25 # tag:url,yyyy:name 26 # eine Version und eine Kategorie 27 # Als Ausgabe wollen wir eine Datei-Adresse im Format 28 # Kategorie/name-version-yyyy-url.yml 29 30 """Read an input-object ('ID' supplies the tag) and translate it to a file-path""" 31 32 import yaml 33 import tag_zu_objekt 34 35 TRENNER_ORDNER = '/' 36 TRENNER_VERSION = '-' 37 TRENNER_JAHR = '-' 38 TRENNER_URL = '-' 39 ENDUNG_DATEI = '.yml' 40 42 """Read a tag and return a 43 corresponding file-path""" 45 self.Eingabe = Eingabe 46 self.tag_string = self.Eingabe["ID"] 47 # wir holen uns das Objekt das dem tag entspricht. 48 self.tag_zum_objekt = tag_zu_objekt.tag_zu_objekt(self.tag_string) 49 self.tag_objekt = self.tag_zum_objekt.tag_objekt() 51 # Mit dem Tag_objekt und dem Eingabe-Wörterbuch können wir nun den Datei-String erzeugen. 52 datei = self.Eingabe['Kategorie'] + TRENNER_ORDNER + self.tag_objekt['Name'] + TRENNER_URL + self.tag_objekt['URL'] + TRENNER_JAHR + self.tag_objekt['Jahr'] + TRENNER_VERSION + str(self.Eingabe['Version']) + ENDUNG_DATEI 53 return datei55 return self.Eingabe['Kategorie']57 return self.tag_objekt['Name'] 58
Trees | Indices | Help |
---|
Generated by Epydoc 3.0alpha3 on Wed Aug 8 12:24:35 2007 | http://epydoc.sourceforge.net |