Package schlachtfeld :: Package amov :: Module Versionsverwaltung
[hide private]
[frames] | no frames]

Source Code for Module schlachtfeld.amov.Versionsverwaltung

 1  #!/bin/env python 
 2  # encoding: utf-8 
 3   
 4  # Charakterverwaltung - Verwalte Charaktere 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  """Manage Versions of saved objects.  
23   
24  This class gets a tag and a cathegory and returns the full ID (including the version). Likely it will ostly be used to retrieve the most recent Version. """ 
25   
26  #### Imports #### 
27   
28  import yaml 
29  import os 
30   
31  #### Imports #### 
32   
33  #### Classes #### 
34   
35 -class Versionen:
36 """Manage Versions"""
37 - def __init__(self, tag=u"tag:1w6.org,2007:Menschen", kategorie=u"Armeen"):
38 #: the unique identifier for content, barring the cathegory. 39 self.tag = tag 40 #: The type of objekt we want to retrieve. 41 self.kategorie = kategorie 42 #: The ID including the most recent version of the objekt. 43 self.neuste = self.neuste_version() 44
45 - def neuste_version(self):
46 """return the most recent version""" 47 ID = {} 48 ID[u"ID"] = self.tag 49 ID[u"Kategorie"] = self.kategorie 50 ID[u"Version"] = u"0.1" 51 return ID
52 53 #### Classes #### 54 55 #### Self-Test #### 56 57 # versionen = Versionen() 58 59 # print versionen.neuste 60 61 # print yaml.dump(versionen.neuste, default_flow_style=False) 62 63 #### Self-Test #### 64