Merge lp:~richies/hypernucleus-server/UberHax_Broken_MadScientist into lp:~hypernucleus/hypernucleus-server/trunk

Proposed by Richie Ward
Status: Merged
Merged at revision: 75
Proposed branch: lp:~richies/hypernucleus-server/UberHax_Broken_MadScientist
Merge into: lp:~hypernucleus/hypernucleus-server/trunk
Diff against target: 1072 lines (+295/-481)
16 files modified
hypernucleusserver/hypernucleusserver/model/board.py (+1/-1)
hypernucleusserver/hypernucleusserver/model/content.py (+2/-1)
hypernucleusserver/hypernucleusserver/model/dependencies.py (+0/-162)
hypernucleusserver/hypernucleusserver/model/gamedep.py (+173/-1)
hypernucleusserver/hypernucleusserver/model/games.py (+0/-159)
hypernucleusserver/hypernucleusserver/model/tags.py (+3/-17)
hypernucleusserver/hypernucleusserver/model/tokens.py (+1/-1)
hypernucleusserver/hypernucleusserver/models.py (+20/-52)
hypernucleusserver/hypernucleusserver/security.py (+2/-1)
hypernucleusserver/hypernucleusserver/viewlib/boardlib.py (+3/-2)
hypernucleusserver/hypernucleusserver/viewlib/contentlib.py (+3/-2)
hypernucleusserver/hypernucleusserver/viewlib/gamedeplib.py (+51/-59)
hypernucleusserver/hypernucleusserver/viewlib/outputlib.py (+24/-13)
hypernucleusserver/hypernucleusserver/viewlib/userlib.py (+3/-1)
hypernucleusserver/hypernucleusserver/views/errwarninfo.py (+5/-2)
hypernucleusserver/hypernucleusserver/views/gamedep.py (+4/-7)
To merge this branch: bzr merge lp:~richies/hypernucleus-server/UberHax_Broken_MadScientist
Reviewer Review Type Date Requested Status
Richie Ward Pending
Review via email: mp+65409@code.launchpad.net

Description of the change

Huge sweeping changes to the model

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'hypernucleusserver/hypernucleusserver/model/board.py'
--- hypernucleusserver/hypernucleusserver/model/board.py 2011-06-18 20:38:51 +0000
+++ hypernucleusserver/hypernucleusserver/model/board.py 2011-06-21 20:38:13 +0000
@@ -2,7 +2,7 @@
2from sqlalchemy import Column, Integer, ForeignKey, Unicode, UniqueConstraint2from sqlalchemy import Column, Integer, ForeignKey, Unicode, UniqueConstraint
3from sqlalchemy import DateTime3from sqlalchemy import DateTime
4from sqlalchemy.orm import relationship4from sqlalchemy.orm import relationship
5from hypernucleusserver.models import Tags, BBThreadTags5from hypernucleusserver.model.tags import Tags, BBThreadTags
6from hypernucleusserver.models import Base as DeclarativeBase6from hypernucleusserver.models import Base as DeclarativeBase
7from hypernucleusserver.model.file import Files7from hypernucleusserver.model.file import Files
8from hypernucleusserver.model.auth import User8from hypernucleusserver.model.auth import User
99
=== modified file 'hypernucleusserver/hypernucleusserver/model/content.py'
--- hypernucleusserver/hypernucleusserver/model/content.py 2011-06-20 14:35:59 +0000
+++ hypernucleusserver/hypernucleusserver/model/content.py 2011-06-21 20:38:13 +0000
@@ -1,7 +1,8 @@
1from datetime import datetime1from datetime import datetime
2from sqlalchemy import ForeignKey, Column, UniqueConstraint, desc2from sqlalchemy import ForeignKey, Column, UniqueConstraint, desc
3from sqlalchemy.types import Integer, Unicode, DateTime, Boolean3from sqlalchemy.types import Integer, Unicode, DateTime, Boolean
4from hypernucleusserver.models import Tags, ContentTags, User4from hypernucleusserver.model.tags import Tags, ContentTags
5from hypernucleusserver.model.auth import User
5from hypernucleusserver.models import Base as DeclarativeBase6from hypernucleusserver.models import Base as DeclarativeBase
6from sqlalchemy.orm import relationship7from sqlalchemy.orm import relationship
78
89
=== removed file 'hypernucleusserver/hypernucleusserver/model/dependencies.py'
--- hypernucleusserver/hypernucleusserver/model/dependencies.py 2011-06-20 14:43:33 +0000
+++ hypernucleusserver/hypernucleusserver/model/dependencies.py 1970-01-01 00:00:00 +0000
@@ -1,162 +0,0 @@
1from datetime import datetime
2from sqlalchemy import Column, Integer, desc
3from sqlalchemy import ForeignKey, UniqueConstraint, Float, DateTime, Boolean
4from sqlalchemy import Unicode
5from sqlalchemy.orm import relationship
6from hypernucleusserver.models import Base as DeclarativeBase
7from hypernucleusserver.models import Tags, DependenciesTags
8from hypernucleusserver.models import OperatingSystems
9from hypernucleusserver.models import Architectures, GameDepModuleType
10from hypernucleusserver.model.file import Files
11from hypernucleusserver.model.auth import User
12
13class DependenciesPicture(DeclarativeBase):
14 __tablename__ = 'dependenciespicture'
15 __table_args__ = (UniqueConstraint('game_id', 'file_id'),
16 {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'})
17
18 id = Column(Integer, primary_key=True)
19 game_id = Column(Integer, ForeignKey('dependenciespage.id'), nullable=False)
20 file_id = Column(Integer, ForeignKey('files.id'), nullable=False)
21
22class DependenciesBinaryFiles(DeclarativeBase):
23 __tablename__ = 'dependenciesbinaryfiles'
24 __table_args__ = (UniqueConstraint('binary_id', 'file_id'),
25 {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'})
26
27 id = Column(Integer, primary_key=True)
28 binary_id = Column(Integer, ForeignKey('dependenciesbinary.id'),
29 nullable=False)
30 file_id = Column(Integer, ForeignKey('files.id'), nullable=False)
31
32class DependenciesBinaryOperatingSystem(DeclarativeBase):
33 __tablename__ = 'dependenciesbinaryoperatingsystem'
34 __table_args__ = (UniqueConstraint('binary_id', 'operatingsystem_id'),
35 {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'})
36
37 id = Column(Integer, primary_key=True)
38 binary_id = Column(Integer, ForeignKey('dependenciesbinary.id'),
39 nullable=False)
40 operatingsystem_id = Column(Integer, ForeignKey('operatingsystems.id'),
41 nullable=False)
42
43class DependenciesBinaryArchitecture(DeclarativeBase):
44 __tablename__ = 'dependenciesbinaryarchitecture'
45 __table_args__ = (UniqueConstraint('binary_id', 'architecture_id'),
46 {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'})
47
48 id = Column(Integer, primary_key=True)
49 binary_id = Column(Integer, ForeignKey('dependenciesbinary.id'),
50 nullable=False)
51 architecture_id = Column(Integer, ForeignKey('architectures.id'),
52 nullable=False)
53
54class DependenciesBinary(DeclarativeBase):
55 __tablename__ = 'dependenciesbinary'
56 __table_args__ = {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'}
57
58 id = Column(Integer, primary_key=True)
59 revision_id = Column(Integer, ForeignKey('dependenciesrevision.id'),
60 nullable=False)
61 file_obj = relationship(Files,
62 secondary=DependenciesBinaryFiles.__table__,
63 uselist=False, single_parent=True,
64 cascade="all, delete, delete-orphan")
65 operatingsystem_obj = relationship(OperatingSystems,
66 secondary=DependenciesBinaryOperatingSystem.__table__,
67 uselist=False)
68 architecture_obj = relationship(Architectures,
69 secondary=DependenciesBinaryArchitecture.__table__,
70 uselist=False)
71
72 def __init__(self, file_obj, operatingsystem_obj, architecture_obj):
73 self.file_obj = file_obj
74 self.operatingsystem_obj = operatingsystem_obj
75 self.architecture_obj = architecture_obj
76
77class DependenciesDependency(DeclarativeBase):
78 __tablename__ = 'dependenciesdependency'
79 __table_args__ = (UniqueConstraint('game_id', 'dependency_id'),
80 {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'})
81
82 id = Column(Integer, primary_key=True)
83 game_id = Column(Integer, ForeignKey('dependenciespage.id'),
84 nullable=False)
85 dependency_id = Column(Integer, ForeignKey('dependenciespage.id'),
86 nullable=False)
87
88class DependenciesRevisionFiles(DeclarativeBase):
89 __tablename__ = 'dependenciesrevisionfiles'
90 __table_args__ = (UniqueConstraint('revision_id', 'file_id'),
91 {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'})
92
93 id = Column(Integer, primary_key=True)
94 revision_id = Column(Integer, ForeignKey('dependenciesrevision.id'),
95 nullable=False)
96 file_id = Column(Integer, ForeignKey('files.id'), nullable=False)
97
98class DependenciesModuleTypeRevision(DeclarativeBase):
99 __tablename__ = 'dependenciesmoduletyperevision'
100 __table_args__ = (UniqueConstraint('revision_id', 'moduletype_id'),
101 {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'})
102
103 id = Column(Integer, primary_key=True)
104 revision_id = Column(Integer, ForeignKey('dependenciesrevision.id'),
105 nullable=False)
106 moduletype_id = Column(Integer, ForeignKey('gamedepmoduletype.id'),
107 nullable=False)
108
109class DependenciesRevision(DeclarativeBase):
110 __tablename__ = 'dependenciesrevision'
111 __table_args__ = {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'}
112
113 id = Column(Integer, primary_key=True)
114 page_id = Column(Integer, ForeignKey('dependenciespage.id'),
115 nullable=False)
116 version = Column(Float(), default=0.1, index=True, nullable=False)
117 created = Column(DateTime, default=datetime.now)
118 published = Column(Boolean, default=False, index=True)
119 page = relationship("DependenciesPage")
120 moduletype = relationship(GameDepModuleType,
121 secondary=DependenciesModuleTypeRevision.__table__,
122 uselist=False)
123 file_obj = relationship(Files,
124 secondary=DependenciesRevisionFiles.__table__,
125 uselist=False)
126 binary = relationship(DependenciesBinary,
127 cascade="all, delete")
128
129 def __init__(self, version, moduletype):
130 self.version = version
131 self.moduletype = moduletype
132
133class DependenciesPage(DeclarativeBase):
134 __tablename__ = 'dependenciespage'
135 __table_args__ = {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'}
136
137 id = Column(Integer, primary_key=True)
138 name = Column(Unicode(128), index=True, unique=True, nullable=False)
139 display_name = Column(Unicode(128), index=True, nullable=False)
140 description = Column(Unicode(16384), default=u"")
141 created = Column(DateTime, default=datetime.now)
142 deleted = Column(Boolean, default=False, index=True)
143 revisions = relationship(DependenciesRevision,
144 cascade="all, delete, delete-orphan",
145 lazy="dynamic",
146 order_by=desc(DependenciesRevision.id),
147 single_parent=True)
148 tags = relationship(Tags, secondary=DependenciesTags.__table__,
149 cascade="all, delete")
150 dependencies = relationship('DependenciesPage',
151 secondary=DependenciesDependency.__table__,
152
153 primaryjoin=id == DependenciesDependency.game_id,
154 secondaryjoin=DependenciesDependency.dependency_id == id,
155 cascade="all, delete")
156 picture = relationship(Files, secondary=DependenciesPicture.__table__,
157 cascade="all, delete")
158
159 def __init__(self, name, display_name):
160 self.name = name
161 self.display_name = display_name
162
1630
=== modified file 'hypernucleusserver/hypernucleusserver/model/gamedep.py'
--- hypernucleusserver/hypernucleusserver/model/gamedep.py 2010-12-16 05:24:55 +0000
+++ hypernucleusserver/hypernucleusserver/model/gamedep.py 2011-06-21 20:38:13 +0000
@@ -1,5 +1,18 @@
1from sqlalchemy import Column, Integer, Unicode1from sqlalchemy import Column, Integer, desc, Unicode
2from sqlalchemy import ForeignKey, UniqueConstraint, Float, DateTime, Boolean
3from sqlalchemy.orm import relationship
2from hypernucleusserver.models import Base as DeclarativeBase4from hypernucleusserver.models import Base as DeclarativeBase
5from hypernucleusserver.model.file import Files
6from hypernucleusserver.model.tags import Tags, GameDepTags
7from datetime import datetime
8class GameDepType(DeclarativeBase):
9 __tablename__ = 'gamedeptype'
10 __table_args__ = {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'}
11 id = Column(Integer, primary_key=True)
12 name = Column(Unicode(128), index=True, unique=True, nullable=False)
13
14 def __init__(self, name):
15 self.name = name
316
4class GameDepModuleType(DeclarativeBase):17class GameDepModuleType(DeclarativeBase):
5 __tablename__ = 'gamedepmoduletype'18 __tablename__ = 'gamedepmoduletype'
@@ -37,3 +50,162 @@
37 def __init__(self, name, display_name):50 def __init__(self, name, display_name):
38 self.name = name51 self.name = name
39 self.display_name = display_name52 self.display_name = display_name
53
54
55
56class GameDepPicture(DeclarativeBase):
57 __tablename__ = 'gamedeppicture'
58 __table_args__ = (UniqueConstraint('game_id', 'file_id'),
59 {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'})
60
61 id = Column(Integer, primary_key=True)
62 game_id = Column(Integer, ForeignKey('gamedeppage.id'), nullable=False)
63 file_id = Column(Integer, ForeignKey('files.id'), nullable=False)
64
65class GameDepBinaryFiles(DeclarativeBase):
66 __tablename__ = 'gamedepbinaryfiles'
67 __table_args__ = (UniqueConstraint('binary_id', 'file_id'),
68 {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'})
69
70 id = Column(Integer, primary_key=True)
71 binary_id = Column(Integer, ForeignKey('gamedepbinary.id'),
72 nullable=False)
73 file_id = Column(Integer, ForeignKey('files.id'), nullable=False)
74
75class GameDepBinaryOperatingSystem(DeclarativeBase):
76 __tablename__ = 'gamedepbinaryoperatingsystem'
77 __table_args__ = (UniqueConstraint('binary_id', 'operatingsystem_id'),
78 {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'})
79
80 id = Column(Integer, primary_key=True)
81 binary_id = Column(Integer, ForeignKey('gamedepbinary.id'),
82 nullable=False)
83 operatingsystem_id = Column(Integer, ForeignKey('operatingsystems.id'),
84 nullable=False)
85
86class GameDepBinaryArchitecture(DeclarativeBase):
87 __tablename__ = 'gamedepbinaryarchitecture'
88 __table_args__ = (UniqueConstraint('binary_id', 'architecture_id'),
89 {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'})
90
91 id = Column(Integer, primary_key=True)
92 binary_id = Column(Integer, ForeignKey('gamedepbinary.id'),
93 nullable=False)
94 architecture_id = Column(Integer, ForeignKey('architectures.id'),
95 nullable=False)
96
97class GameDepBinary(DeclarativeBase):
98 __tablename__ = 'gamedepbinary'
99 __table_args__ = {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'}
100
101 id = Column(Integer, primary_key=True)
102 revision_id = Column(Integer, ForeignKey('gamedeprevision.id'),
103 nullable=False)
104 file_obj = relationship(Files,
105 secondary=GameDepBinaryFiles.__table__,
106 uselist=False, single_parent=True,
107 cascade="all, delete, delete-orphan")
108 operatingsystem_obj = relationship(OperatingSystems,
109 secondary=GameDepBinaryOperatingSystem.__table__,
110 uselist=False)
111 architecture_obj = relationship(Architectures,
112 secondary=GameDepBinaryArchitecture.__table__,
113 uselist=False)
114
115 def __init__(self, file_obj, operatingsystem_obj, architecture_obj):
116 self.file_obj = file_obj
117 self.operatingsystem_obj = operatingsystem_obj
118 self.architecture_obj = architecture_obj
119
120class GameDepDependency(DeclarativeBase):
121 __tablename__ = 'gamedepdependency'
122 __table_args__ = (UniqueConstraint('game_id', 'dependency_id'),
123 {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'})
124
125 id = Column(Integer, primary_key=True)
126 game_id = Column(Integer, ForeignKey('gamedeppage.id'),
127 nullable=False)
128 dependency_id = Column(Integer, ForeignKey('gamedeppage.id'),
129 nullable=False)
130
131class GameDepRevisionFiles(DeclarativeBase):
132 __tablename__ = 'gamedeprevisionfiles'
133 __table_args__ = (UniqueConstraint('revision_id', 'file_id'),
134 {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'})
135
136 id = Column(Integer, primary_key=True)
137 revision_id = Column(Integer, ForeignKey('gamedeprevision.id'),
138 nullable=False)
139 file_id = Column(Integer, ForeignKey('files.id'), nullable=False)
140
141class GameDepModuleTypeRevision(DeclarativeBase):
142 __tablename__ = 'gamedepmoduletyperevision'
143 __table_args__ = (UniqueConstraint('revision_id', 'moduletype_id'),
144 {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'})
145
146 id = Column(Integer, primary_key=True)
147 revision_id = Column(Integer, ForeignKey('gamedeprevision.id'),
148 nullable=False)
149 moduletype_id = Column(Integer, ForeignKey('gamedepmoduletype.id'),
150 nullable=False)
151
152
153
154
155class GameDepRevision(DeclarativeBase):
156 __tablename__ = 'gamedeprevision'
157 __table_args__ = {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'}
158
159 id = Column(Integer, primary_key=True)
160 page_id = Column(Integer, ForeignKey('gamedeppage.id'),
161 nullable=False)
162 page = relationship("GameDepPage")
163 version = Column(Float(), default=0.1, index=True, nullable=False)
164 created = Column(DateTime, default=datetime.now)
165 published = Column(Boolean, default=False, index=True)
166 moduletype = relationship(GameDepModuleType,
167 secondary=GameDepModuleTypeRevision.__table__,
168 uselist=False)
169 file_obj = relationship(Files,
170 secondary=GameDepRevisionFiles.__table__,
171 uselist=False)
172 binary = relationship(GameDepBinary,
173 cascade="all, delete")
174
175 def __init__(self, version, moduletype):
176 self.version = version
177 self.moduletype = moduletype
178
179class GameDepPage(DeclarativeBase):
180 __tablename__ = 'gamedeppage'
181 __table_args__ = {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'}
182
183 id = Column(Integer, primary_key=True)
184 gamedeptype_id = Column(Integer, ForeignKey('gamedeptype.id'),
185 nullable=False)
186 gamedeptype = relationship(GameDepType, uselist=False)
187 name = Column(Unicode(128), index=True, unique=True, nullable=False)
188 display_name = Column(Unicode(128), index=True, nullable=False)
189 description = Column(Unicode(16384), default=u"")
190 created = Column(DateTime, default=datetime.now)
191 deleted = Column(Boolean, default=False, index=True)
192 revisions = relationship(GameDepRevision,
193 cascade="all, delete, delete-orphan",
194 lazy="dynamic",
195 order_by=desc(GameDepRevision.id),
196 single_parent=True)
197 tags = relationship(Tags, secondary=GameDepTags.__table__,
198 cascade="all, delete")
199 dependencies = relationship('GameDepPage',
200 secondary=GameDepDependency.__table__,
201
202 primaryjoin=id == GameDepDependency.game_id,
203 secondaryjoin=GameDepDependency.dependency_id == id,
204 cascade="all, delete")
205 picture = relationship(Files, secondary=GameDepPicture.__table__,
206 cascade="all, delete")
207
208 def __init__(self, gamedeptype, name, display_name):
209 self.name = name
210 self.display_name = display_name
211 self.gamedeptype = gamedeptype
40\ No newline at end of file212\ No newline at end of file
41213
=== removed file 'hypernucleusserver/hypernucleusserver/model/games.py'
--- hypernucleusserver/hypernucleusserver/model/games.py 2011-06-20 14:43:33 +0000
+++ hypernucleusserver/hypernucleusserver/model/games.py 1970-01-01 00:00:00 +0000
@@ -1,159 +0,0 @@
1from datetime import datetime
2from sqlalchemy import Column, Integer, desc
3from sqlalchemy import ForeignKey, UniqueConstraint, Float, DateTime, Boolean
4from sqlalchemy import Unicode
5from sqlalchemy.orm import relationship
6from hypernucleusserver.models import Base as DeclarativeBase
7from hypernucleusserver.models import Tags, GamesTags
8from hypernucleusserver.models import OperatingSystems
9from hypernucleusserver.models import Architectures, GameDepModuleType
10from hypernucleusserver.model.file import Files
11from hypernucleusserver.model.auth import User
12
13class GamesPicture(DeclarativeBase):
14 __tablename__ = 'gamespicture'
15 __table_args__ = (UniqueConstraint('game_id', 'file_id'),
16 {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'})
17
18 id = Column(Integer, primary_key=True)
19 game_id = Column(Integer, ForeignKey('gamespage.id'), nullable=False)
20 file_id = Column(Integer, ForeignKey('files.id'), nullable=False)
21
22class GamesBinaryFiles(DeclarativeBase):
23 __tablename__ = 'gamesbinaryfiles'
24 __table_args__ = (UniqueConstraint('binary_id', 'file_id'),
25 {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'})
26
27 id = Column(Integer, primary_key=True)
28 binary_id = Column(Integer, ForeignKey('gamesbinary.id'),
29 nullable=False)
30 file_id = Column(Integer, ForeignKey('files.id'), nullable=False)
31
32class GamesBinaryOperatingSystem(DeclarativeBase):
33 __tablename__ = 'gamesbinaryoperatingsystem'
34 __table_args__ = (UniqueConstraint('binary_id', 'operatingsystem_id'),
35 {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'})
36
37 id = Column(Integer, primary_key=True)
38 binary_id = Column(Integer, ForeignKey('gamesbinary.id'),
39 nullable=False)
40 operatingsystem_id = Column(Integer, ForeignKey('operatingsystems.id'),
41 nullable=False)
42
43class GamesBinaryArchitecture(DeclarativeBase):
44 __tablename__ = 'gamesbinaryarchitecture'
45 __table_args__ = (UniqueConstraint('binary_id', 'architecture_id'),
46 {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'})
47
48 id = Column(Integer, primary_key=True)
49 binary_id = Column(Integer, ForeignKey('gamesbinary.id'),
50 nullable=False)
51 architecture_id = Column(Integer, ForeignKey('architectures.id'),
52 nullable=False)
53
54class GamesBinary(DeclarativeBase):
55 __tablename__ = 'gamesbinary'
56 __table_args__ = {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'}
57
58 id = Column(Integer, primary_key=True)
59 revision_id = Column(Integer, ForeignKey('gamesrevision.id'),
60 nullable=False)
61 file_obj = relationship(Files,
62 secondary=GamesBinaryFiles.__table__,
63 uselist=False, single_parent=True,
64 cascade="all, delete, delete-orphan")
65 operatingsystem_obj = relationship(OperatingSystems,
66 secondary=GamesBinaryOperatingSystem.__table__,
67 uselist=False)
68 architecture_obj = relationship(Architectures,
69 secondary=GamesBinaryArchitecture.__table__,
70 uselist=False)
71
72 def __init__(self, file_obj, operatingsystem_obj, architecture_obj):
73 self.file_obj = file_obj
74 self.operatingsystem_obj = operatingsystem_obj
75 self.architecture_obj = architecture_obj
76
77class GamesDependency(DeclarativeBase):
78 __tablename__ = 'gamesdependency'
79 __table_args__ = (UniqueConstraint('game_id', 'dependency_id'),
80 {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'})
81
82 id = Column(Integer, primary_key=True)
83 game_id = Column(Integer, ForeignKey('gamespage.id'),
84 nullable=False)
85 dependency_id = Column(Integer, ForeignKey('dependenciespage.id'),
86 nullable=False)
87
88class GamesRevisionFiles(DeclarativeBase):
89 __tablename__ = 'gamesrevisionfiles'
90 __table_args__ = (UniqueConstraint('revision_id', 'file_id'),
91 {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'})
92
93 id = Column(Integer, primary_key=True)
94 revision_id = Column(Integer, ForeignKey('gamesrevision.id'),
95 nullable=False)
96 file_id = Column(Integer, ForeignKey('files.id'), nullable=False)
97
98class GamesModuleTypeRevision(DeclarativeBase):
99 __tablename__ = 'gamesmoduletyperevision'
100 __table_args__ = (UniqueConstraint('revision_id', 'moduletype_id'),
101 {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'})
102
103 id = Column(Integer, primary_key=True)
104 revision_id = Column(Integer, ForeignKey('gamesrevision.id'),
105 nullable=False)
106 moduletype_id = Column(Integer, ForeignKey('gamedepmoduletype.id'),
107 nullable=False)
108
109class GamesRevision(DeclarativeBase):
110 __tablename__ = 'gamesrevision'
111 __table_args__ = {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'}
112
113 id = Column(Integer, primary_key=True)
114 page_id = Column(Integer, ForeignKey('gamespage.id'),
115 nullable=False)
116 version = Column(Float(), default=0.1, index=True, nullable=False)
117 created = Column(DateTime, default=datetime.now)
118 published = Column(Boolean, default=False, index=True)
119 page = relationship("GamesPage")
120 moduletype = relationship(GameDepModuleType,
121 secondary=GamesModuleTypeRevision.__table__,
122 uselist=False)
123 file_obj = relationship(Files,
124 secondary=GamesRevisionFiles.__table__,
125 uselist=False)
126 binary = relationship(GamesBinary,
127 cascade="all, delete")
128
129 def __init__(self, version, moduletype):
130 self.version = version
131 self.moduletype = moduletype
132
133class GamesPage(DeclarativeBase):
134 __tablename__ = 'gamespage'
135 __table_args__ = {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'}
136
137 id = Column(Integer, primary_key=True)
138 name = Column(Unicode(128), index=True, unique=True, nullable=False)
139 display_name = Column(Unicode(128), index=True, nullable=False)
140 description = Column(Unicode(16384), default=u"")
141 created = Column(DateTime, default=datetime.now)
142 deleted = Column(Boolean, default=False, index=True)
143 revisions = relationship(GamesRevision,
144 cascade="all, delete, delete-orphan",
145 lazy="dynamic",
146 order_by=desc(GamesRevision.id),
147 single_parent=True)
148 tags = relationship(Tags, secondary=GamesTags.__table__,
149 cascade="all, delete")
150 dependencies = relationship('DependenciesPage',
151 secondary=GamesDependency.__table__,
152 cascade="all, delete")
153 picture = relationship(Files, secondary=GamesPicture.__table__,
154 cascade="all, delete")
155
156 def __init__(self, name, display_name):
157 self.name = name
158 self.display_name = display_name
159
1600
=== modified file 'hypernucleusserver/hypernucleusserver/model/tags.py'
--- hypernucleusserver/hypernucleusserver/model/tags.py 2011-06-18 10:18:12 +0000
+++ hypernucleusserver/hypernucleusserver/model/tags.py 2011-06-21 20:38:13 +0000
@@ -11,28 +11,14 @@
11 def __init__(self, name):11 def __init__(self, name):
12 self.name = name12 self.name = name
1313
14class DependenciesTags(DeclarativeBase):14class GameDepTags(DeclarativeBase):
15 __tablename__ = 'dependenciestags'15 __tablename__ = 'gamedeptags'
16 __table_args__ = (UniqueConstraint('tag_id', 'dependency_id'),
17 {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'})
18
19 id = Column(Integer, primary_key=True)
20 tag_id = Column(Integer, ForeignKey('tags.id'), nullable=False)
21 dependency_id = Column(Integer, ForeignKey('dependenciespage.id'),
22 nullable=False)
23
24 def __init__(self, tag_id, dependency_id):
25 self.tag_id = tag_id
26 self.dependency_id = dependency_id
27
28class GamesTags(DeclarativeBase):
29 __tablename__ = 'gamestags'
30 __table_args__ = (UniqueConstraint('tag_id', 'game_id'),16 __table_args__ = (UniqueConstraint('tag_id', 'game_id'),
31 {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'})17 {'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'})
32 18
33 id = Column(Integer, primary_key=True)19 id = Column(Integer, primary_key=True)
34 tag_id = Column(Integer, ForeignKey('tags.id'), nullable=False)20 tag_id = Column(Integer, ForeignKey('tags.id'), nullable=False)
35 game_id = Column(Integer, ForeignKey('gamespage.id'), nullable=False)21 game_id = Column(Integer, ForeignKey('gamedeppage.id'), nullable=False)
36 22
37 def __init__(self, game_id, tag_id):23 def __init__(self, game_id, tag_id):
38 self.game_id = game_id24 self.game_id = game_id
3925
=== modified file 'hypernucleusserver/hypernucleusserver/model/tokens.py'
--- hypernucleusserver/hypernucleusserver/model/tokens.py 2011-06-20 14:35:59 +0000
+++ hypernucleusserver/hypernucleusserver/model/tokens.py 2011-06-21 20:38:13 +0000
@@ -3,7 +3,7 @@
3from sqlalchemy.orm import relationship3from sqlalchemy.orm import relationship
4from datetime import datetime, timedelta4from datetime import datetime, timedelta
5from hypernucleusserver.models import Base as DeclarativeBase5from hypernucleusserver.models import Base as DeclarativeBase
6from hypernucleusserver.models import User6from hypernucleusserver.model.auth import User
7import uuid7import uuid
88
9def gen_token():9def gen_token():
1010
=== modified file 'hypernucleusserver/hypernucleusserver/models.py'
--- hypernucleusserver/hypernucleusserver/models.py 2011-06-21 17:37:46 +0000
+++ hypernucleusserver/hypernucleusserver/models.py 2011-06-21 20:38:13 +0000
@@ -9,61 +9,25 @@
9from sqlalchemy.orm import sessionmaker9from sqlalchemy.orm import sessionmaker
10from sqlalchemy.ext.declarative import declarative_base10from sqlalchemy.ext.declarative import declarative_base
11from sqlalchemy.exc import IntegrityError11from sqlalchemy.exc import IntegrityError
12from sqlalchemy.orm.exc import NoResultFound
13from sqlalchemy import create_engine12from sqlalchemy import create_engine
14
15from zope.sqlalchemy import ZopeTransactionExtension13from zope.sqlalchemy import ZopeTransactionExtension
1614
17DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension()))15DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension()))
18Base = declarative_base()16Base = declarative_base()
1917
20from hypernucleusserver.model.gamedep import GameDepModuleType18from hypernucleusserver.model.auth import ACLParent, ACLChild, User, Group
21from hypernucleusserver.model.gamedep import OperatingSystems, Architectures19from hypernucleusserver.model.auth import Sexes
22from hypernucleusserver.model.tags import Tags, DependenciesTags, GamesTags20from hypernucleusserver.model.gamedep import Architectures, OperatingSystems
23from hypernucleusserver.model.tags import ContentTags, BBThreadTags21from hypernucleusserver.model.gamedep import GameDepModuleType, GameDepPage
24from hypernucleusserver.model.auth import Sexes, User, Group, ACLParent22from hypernucleusserver.model.gamedep import GameDepType
25from hypernucleusserver.model.auth import ACLChild, UserGroup23from hypernucleusserver.model.errwarninfo import ErrWarnInfoInfo
26from hypernucleusserver.model.auth import UserSexes24from hypernucleusserver.model.errwarninfo import ErrWarnInfoError
25from hypernucleusserver.model.errwarninfo import ErrWarnInfoWarn
27from hypernucleusserver.model.content import ContentPage, ContentRevision26from hypernucleusserver.model.content import ContentPage, ContentRevision
28from hypernucleusserver.model.board import BBCategory, BBPost27from hypernucleusserver.model.board import BBCategory, BBPost
29from hypernucleusserver.model.board import BBThread, BBForum28from hypernucleusserver.model.board import BBThread, BBForum
30from hypernucleusserver.model.file import Files, FilesData29from hypernucleusserver.model.tags import Tags
31from hypernucleusserver.model.tokens import Token30
32from hypernucleusserver.model.errwarninfo import ErrWarnInfoInfo
33from hypernucleusserver.model.errwarninfo import ErrWarnInfoError
34from hypernucleusserver.model.errwarninfo import ErrWarnInfoWarn
35
36from hypernucleusserver.model.dependencies import DependenciesBinary
37from hypernucleusserver.model.dependencies import \
38 DependenciesBinaryArchitecture
39from hypernucleusserver.model.dependencies import \
40 DependenciesBinaryFiles
41from hypernucleusserver.model.dependencies import \
42 DependenciesBinaryOperatingSystem
43from hypernucleusserver.model.dependencies import DependenciesPage
44from hypernucleusserver.model.dependencies import DependenciesPicture
45from hypernucleusserver.model.dependencies import DependenciesRevision
46from hypernucleusserver.model.dependencies import \
47 DependenciesRevisionFiles
48from hypernucleusserver.model.dependencies import \
49 DependenciesModuleTypeRevision
50
51from hypernucleusserver.model.games import GamesBinary
52from hypernucleusserver.model.games import \
53 GamesBinaryArchitecture
54from hypernucleusserver.model.games import \
55 GamesBinaryFiles
56from hypernucleusserver.model.games import \
57 GamesBinaryOperatingSystem
58from hypernucleusserver.model.games import GamesPage
59from hypernucleusserver.model.games import GamesPicture
60from hypernucleusserver.model.games import GamesRevision
61from hypernucleusserver.model.games import \
62 GamesRevisionFiles
63from hypernucleusserver.model.games import \
64 GamesModuleTypeRevision
65
66
67class RootFactory(object):31class RootFactory(object):
68 __acl__ = set()32 __acl__ = set()
69 33
@@ -341,25 +305,29 @@
341 session.add(pygame)305 session.add(pygame)
342 session.add(pcgame)306 session.add(pcgame)
343 307
308 # Add the GameDepTypes
309 gametype = GameDepType(u"game")
310 deptype = GameDepType(u"dep")
311
344 # Add some primitive games and dependencies312 # Add some primitive games and dependencies
345 depzero = DependenciesPage(u"testzero", u"Test Zero")313 depzero = GameDepPage(deptype, u"testzero", u"Test Zero")
346 session.add(depzero)314 session.add(depzero)
347 depone = DependenciesPage(u"testdep", u"Test Dependency")315 depone = GameDepPage(deptype, u"testdep", u"Test Dependency")
348 depone.dependencies.append(depzero)316 depone.dependencies.append(depzero)
349 depone.tags.append(first_tag)317 depone.tags.append(first_tag)
350 session.add(depone)318 session.add(depone)
351 deptwo = DependenciesPage(u"testdeptwo", u"Test Dependency Two")319 deptwo = GameDepPage(deptype, u"testdeptwo", u"Test Dependency Two")
352 deptwo.dependencies.append(depzero)320 deptwo.dependencies.append(depzero)
353 session.add(deptwo)321 session.add(deptwo)
354 depthree = DependenciesPage(u"testdepthree", u"Test Dependency Three")322 depthree = GameDepPage(deptype, u"testdepthree", u"Test Dependency Three")
355 depthree.dependencies.append(deptwo)323 depthree.dependencies.append(deptwo)
356 depthree.dependencies.append(depzero)324 depthree.dependencies.append(depzero)
357 session.add(depthree)325 session.add(depthree)
358 326
359 gameone = GamesPage(u"testgame", u"Test Game")327 gameone = GameDepPage(gametype, u"testgame", u"Test Game")
360 gameone.tags.append(first_tag)328 gameone.tags.append(first_tag)
361 session.add(gameone)329 session.add(gameone)
362 gametwo = GamesPage(u"testgametwo", u"Test Game Two")330 gametwo = GameDepPage(gametype, u"testgametwo", u"Test Game Two")
363 gametwo.dependencies.append(depone)331 gametwo.dependencies.append(depone)
364 session.add(gametwo)332 session.add(gametwo)
365 333
366334
=== modified file 'hypernucleusserver/hypernucleusserver/security.py'
--- hypernucleusserver/hypernucleusserver/security.py 2010-12-16 05:24:55 +0000
+++ hypernucleusserver/hypernucleusserver/security.py 2011-06-21 20:38:13 +0000
@@ -1,4 +1,5 @@
1from hypernucleusserver.models import User, DBSession1from hypernucleusserver.model.auth import User
2from hypernucleusserver.models import DBSession
2def groupfinder(userid, request):3def groupfinder(userid, request):
3 dbsession = DBSession()4 dbsession = DBSession()
4 auth = dbsession.query(User).filter(User.name==unicode(userid)).first()5 auth = dbsession.query(User).filter(User.name==unicode(userid)).first()
56
=== modified file 'hypernucleusserver/hypernucleusserver/viewlib/boardlib.py'
--- hypernucleusserver/hypernucleusserver/viewlib/boardlib.py 2011-06-18 17:05:05 +0000
+++ hypernucleusserver/hypernucleusserver/viewlib/boardlib.py 2011-06-21 20:38:13 +0000
@@ -1,5 +1,6 @@
1from hypernucleusserver.models import DBSession, BBCategory, BBForum, BBThread1from hypernucleusserver.models import DBSession
2from hypernucleusserver.models import NoResultFound2from sqlalchemy.orm.exc import NoResultFound
3from hypernucleusserver.model.board import BBCategory, BBForum, BBThread
34
4class CategoryNotFound(Exception):5class CategoryNotFound(Exception):
5 pass6 pass
67
=== modified file 'hypernucleusserver/hypernucleusserver/viewlib/contentlib.py'
--- hypernucleusserver/hypernucleusserver/viewlib/contentlib.py 2011-06-16 16:31:38 +0000
+++ hypernucleusserver/hypernucleusserver/viewlib/contentlib.py 2011-06-21 20:38:13 +0000
@@ -1,5 +1,6 @@
1from hypernucleusserver.models import DBSession, ContentPage1from hypernucleusserver.models import DBSession
2from hypernucleusserver.models import ContentRevision, NoResultFound2from sqlalchemy.orm.exc import NoResultFound
3from hypernucleusserver.model.content import ContentRevision, ContentPage
3from hypernucleusserver.viewlib.helpers import bbcode4from hypernucleusserver.viewlib.helpers import bbcode
4import transaction5import transaction
56
67
=== modified file 'hypernucleusserver/hypernucleusserver/viewlib/gamedeplib.py'
--- hypernucleusserver/hypernucleusserver/viewlib/gamedeplib.py 2011-06-18 20:55:24 +0000
+++ hypernucleusserver/hypernucleusserver/viewlib/gamedeplib.py 2011-06-21 20:38:13 +0000
@@ -1,12 +1,9 @@
1from hypernucleusserver.models import DBSession, NoResultFound1from hypernucleusserver.models import DBSession
2from hypernucleusserver.models import GameDepModuleType, \2from sqlalchemy.orm.exc import NoResultFound
3 OperatingSystems, Architectures3from hypernucleusserver.model.gamedep import GameDepModuleType
4from hypernucleusserver.model.dependencies import DependenciesBinary4from hypernucleusserver.model.gamedep import OperatingSystems, Architectures
5from hypernucleusserver.model.dependencies import DependenciesPage5from hypernucleusserver.model.gamedep import GameDepBinary, GameDepPage
6from hypernucleusserver.model.dependencies import DependenciesRevision6from hypernucleusserver.model.gamedep import GameDepRevision, GameDepType
7from hypernucleusserver.model.games import GamesBinary
8from hypernucleusserver.model.games import GamesPage
9from hypernucleusserver.model.games import GamesRevision
10#from hypernucleusserver.viewlib.helpers import bbcode7#from hypernucleusserver.viewlib.helpers import bbcode
11from hypernucleusserver.viewlib.filelib import AlchemyIO8from hypernucleusserver.viewlib.filelib import AlchemyIO
12import transaction9import transaction
@@ -63,18 +60,24 @@
63 if not gamedep_type in [GAME, DEP]:60 if not gamedep_type in [GAME, DEP]:
64 raise InvalidGameDepType61 raise InvalidGameDepType
65 self.gamedep_type = gamedep_type62 self.gamedep_type = gamedep_type
66 63
64 def get_gamedeptype(self):
65 if self.gamedep_type == GAME:
66 gamedeptype = DBSession.query(GameDepType).filter_by(
67 name=u"game").one()
68 else:
69 gamedeptype = DBSession.query(GameDepType).filter_by(
70 name=u"dep").one()
71 return gamedeptype
72
67 def list(self):73 def list(self):
68 """74 """
69 List all the pages75 List all the pages
70 """76 """
71 result = set()77 result = set()
72 if self.gamedep_type == GAME:78 gamedeptype = self.get_gamedeptype()
73 gamedeps = DBSession.query(GamesPage).filter_by(79 gamedeps = DBSession.query(GameDepPage).filter_by(
74 deleted=False)80 gamedeptype_id=gamedeptype.id, deleted=False)
75 else:
76 gamedeps = DBSession.query(DependenciesPage).filter_by(
77 deleted=False)
78 if not gamedeps:81 if not gamedeps:
79 raise GameDepNotFound82 raise GameDepNotFound
80 for gamedep in gamedeps:83 for gamedep in gamedeps:
@@ -90,7 +93,8 @@
90 display_name = unicode(display_name)93 display_name = unicode(display_name)
91 description = unicode(description)94 description = unicode(description)
92 if not self.exists(name, raise_if_found=True):95 if not self.exists(name, raise_if_found=True):
93 page = self.show(name)[0]96 gamedeptype = self.get_gamedeptype()
97 page = GameDepPage(gamedeptype, name, display_name)
94 page.description = description98 page.description = description
95 DBSession.add(page)99 DBSession.add(page)
96 transaction.commit()100 transaction.commit()
@@ -119,10 +123,7 @@
119 moduletype = self.get_moduletype(moduletype)123 moduletype = self.get_moduletype(moduletype)
120 if not self.exists(name, version, raise_if_found=True):124 if not self.exists(name, version, raise_if_found=True):
121 page, rev = self.show(name)125 page, rev = self.show(name)
122 if self.gamedep_type == GAME:126 rev = GameDepRevision(version, moduletype)
123 rev = GamesRevision(version, moduletype)
124 else:
125 rev = DependenciesRevision(version, moduletype)
126 page.revisions.append(rev)127 page.revisions.append(rev)
127 transaction.commit()128 transaction.commit()
128129
@@ -172,12 +173,8 @@
172173
173 def show_binary(self, binaryid):174 def show_binary(self, binaryid):
174 try:175 try:
175 if self.gamedep_type == GAME:176 bin_obj = DBSession.query(GameDepBinary).filter_by(
176 bin_obj = DBSession.query(GamesBinary).filter_by(177 id=binaryid).one()
177 id=binaryid).one()
178 else:
179 bin_obj = DBSession.query(DependenciesBinary).filter_by(
180 id=binaryid).one()
181 except NoResultFound:178 except NoResultFound:
182 raise GameDepNotFound179 raise GameDepNotFound
183 return bin_obj180 return bin_obj
@@ -201,14 +198,8 @@
201 aio = AlchemyIO(fle=binary, sess=DBSession, 198 aio = AlchemyIO(fle=binary, sess=DBSession,
202 mime=mimetype, filename=filename)199 mime=mimetype, filename=filename)
203 aio_obj = aio.write()200 aio_obj = aio.write()
204 201 bin_obj = GameDepBinary(aio_obj, os_obj, arch_obj)
205 if self.gamedep_type == GAME:
206 bin_obj = GamesBinary(aio_obj, os_obj, arch_obj)
207 else:
208 bin_obj = DependenciesBinary(aio_obj, os_obj, arch_obj)
209
210 rev.binary.append(bin_obj)202 rev.binary.append(bin_obj)
211
212 transaction.commit()203 transaction.commit()
213204
214 def update_binary(self, name, revision, binaryid, operatingsystem, 205 def update_binary(self, name, revision, binaryid, operatingsystem,
@@ -272,10 +263,12 @@
272 """263 """
273 name = unicode(name)264 name = unicode(name)
274 dep_id = int(dep_id)265 dep_id = int(dep_id)
275 266 gamedeptype = DBSession.query(GameDepType).filter_by(
267 name=u"dep").one()
276 try:268 try:
277 dep = DBSession.query(DependenciesPage).filter_by(269 dep = DBSession.query(GameDepPage).filter_by(
278 id=dep_id).one()270 gamedeptype_id=gamedeptype.id,
271 deleted=False, id=dep_id).one()
279 except NoResultFound:272 except NoResultFound:
280 raise GameDepNotFound273 raise GameDepNotFound
281 274
@@ -334,11 +327,11 @@
334 """327 """
335 name = unicode(name)328 name = unicode(name)
336 try:329 try:
337 if self.gamedep_type == GAME:330 gamedeptype = self.get_gamedeptype()
338 page = DBSession.query(GamesPage).filter_by(name=name).one()331 page = DBSession.query(GameDepPage).filter_by(
339 else:332 name=name,
340 page = DBSession.query(DependenciesPage).filter_by(333 gamedeptype_id=gamedeptype.id,
341 name=name).one()334 deleted=False).one()
342 except NoResultFound:335 except NoResultFound:
343 return False336 return False
344 337
@@ -413,7 +406,10 @@
413 return archlist406 return archlist
414 407
415 def dependency_dropdown(self):408 def dependency_dropdown(self):
416 page = DBSession.query(DependenciesPage.id, DependenciesPage.name)409 gamedeptype = DBSession.query(GameDepType).filter_by(
410 name=u"dep").one()
411 page = DBSession.query(GameDepPage.id, GameDepPage.name).filter_by(
412 deleted=False, gamedeptype_id=gamedeptype.id)
417 return page.all()413 return page.all()
418 414
419 def show(self, name, revision=None):415 def show(self, name, revision=None):
@@ -429,27 +425,23 @@
429 425
430 if not revision:426 if not revision:
431 try:427 try:
432 if self.gamedep_type == GAME:428 gamedeptype = self.get_gamedeptype()
433 page = DBSession.query(GamesPage).filter_by(429 page = DBSession.query(GameDepPage).filter_by(
434 name=name).one()430 name=name,
435 else:431 gamedeptype_id=gamedeptype.id,
436 page = DBSession.query(DependenciesPage).filter_by(432 deleted=False).one()
437 name=name).one()
438 return (page, None)433 return (page, None)
439 except NoResultFound:434 except NoResultFound:
440 raise GameDepNotFound435 raise GameDepNotFound
441 else:436 else:
442 try:437 try:
443 if self.gamedep_type == GAME:438 gamedeptype = self.get_gamedeptype()
444 page = DBSession.query(GamesPage).filter_by(439 page = DBSession.query(GameDepPage).filter_by(
445 name=name).one()440 name=name,
446 rev = DBSession.query(GamesRevision).filter_by(441 gamedeptype_id=gamedeptype.id,
447 id=revision).one() 442 deleted=False).one()
448 else:443 rev = DBSession.query(GameDepRevision).filter_by(
449 page = DBSession.query(DependenciesPage).filter_by(444 id=revision).one()
450 name=name).one()
451 rev = DBSession.query(DependenciesRevision).filter_by(
452 id=revision).one()
453 if not rev in page.revisions:445 if not rev in page.revisions:
454 raise GameDepNotFound446 raise GameDepNotFound
455 447
456448
=== modified file 'hypernucleusserver/hypernucleusserver/viewlib/outputlib.py'
--- hypernucleusserver/hypernucleusserver/viewlib/outputlib.py 2011-06-19 17:05:44 +0000
+++ hypernucleusserver/hypernucleusserver/viewlib/outputlib.py 2011-06-21 20:38:13 +0000
@@ -1,7 +1,8 @@
1from hypernucleusserver.models import DBSession, GamesPage, DependenciesPage1from hypernucleusserver.models import DBSession
2from hypernucleusserver.models import NoResultFound, GamesPicture, Files2from sqlalchemy.orm.exc import NoResultFound
3from hypernucleusserver.models import GamesBinary, DependenciesBinary3from hypernucleusserver.model.gamedep import GameDepPage, GameDepType
4from xml.etree.ElementTree import Element, SubElement, ElementTree, tostring4from hypernucleusserver.model.file import Files
5from xml.etree.ElementTree import Element, SubElement, tostring
5import json6import json
67
7class FileNotFound(Exception):8class FileNotFound(Exception):
@@ -62,8 +63,12 @@
62 uploadurl = self.uploadurl63 uploadurl = self.uploadurl
63 sess = DBSession64 sess = DBSession
64 root = Element("hypernucleus")65 root = Element("hypernucleus")
65 dbgame = sess.query(GamesPage).all()66 gametype = sess.query(GameDepType).filter_by(name="game").one()
66 dbdependency = sess.query(DependenciesPage).all()67 deptype = sess.query(GameDepType).filter_by(name="dep").one()
68 dbgame = sess.query(GameDepPage).filter_by(
69 gamedeptype_id=gametype.id, deleted=False).all()
70 dbdep = sess.query(GameDepPage).filter_by(
71 gamedeptype_id=deptype.id, deleted=False).all()
67 for dbitem in dbgame:72 for dbitem in dbgame:
68 game = SubElement(root, "game")73 game = SubElement(root, "game")
69 SubElement(game, "name").text = dbitem.display_name74 SubElement(game, "name").text = dbitem.display_name
@@ -82,7 +87,7 @@
82 dependency = SubElement(game, "dependency")87 dependency = SubElement(game, "dependency")
83 SubElement(dependency, "modulename").text = dbdepitem.name88 SubElement(dependency, "modulename").text = dbdepitem.name
84 SubElement(dependency, "version").text = "1" #str(dbdepitem.version)89 SubElement(dependency, "version").text = "1" #str(dbdepitem.version)
85 for dbitem in dbdependency:90 for dbitem in dbdep:
86 if countobj(dbitem.revisions) > 0:91 if countobj(dbitem.revisions) > 0:
87 for binary in dbitem.revisions[0].binary:92 for binary in dbitem.revisions[0].binary:
88 dependency = SubElement(root, "dependency")93 dependency = SubElement(root, "dependency")
@@ -102,9 +107,12 @@
102 107
103 def show_new_xml(self):108 def show_new_xml(self):
104 root = Element("hypernucleus")109 root = Element("hypernucleus")
105 game = DBSession.query(GamesPage).filter_by(deleted=False).all()110 gametype = DBSession.query(GameDepType).filter_by(name="game").one()
106 dep = DBSession.query(DependenciesPage).filter_by(111 deptype = DBSession.query(GameDepType).filter_by(name="dep").one()
107 deleted=False).all()112 game = DBSession.query(GameDepPage).filter_by(
113 gamedeptype_id=gametype.id, deleted=False).all()
114 dep = DBSession.query(GameDepPage).filter_by(
115 gamedeptype_id=deptype.id, deleted=False).all()
108 for gamedep in [game, dep]:116 for gamedep in [game, dep]:
109 for item in gamedep:117 for item in gamedep:
110 if gamedep == game:118 if gamedep == game:
@@ -150,9 +158,12 @@
150 """158 """
151 root = []159 root = []
152 key = None160 key = None
153 game = DBSession.query(GamesPage).filter_by(deleted=False).all()161 gametype = DBSession.query(GameDepType).filter_by(name="game").one()
154 dep = DBSession.query(DependenciesPage).filter_by(162 deptype = DBSession.query(GameDepType).filter_by(name="dep").one()
155 deleted=False).all()163 game = DBSession.query(GameDepPage).filter_by(
164 gamedeptype_id=gametype.id, deleted=False).all()
165 dep = DBSession.query(GameDepPage).filter_by(
166 gamedeptype_id=deptype.id, deleted=False).all()
156 for gamedep in [game, dep]:167 for gamedep in [game, dep]:
157 if gamedep == game:168 if gamedep == game:
158 key = "game"169 key = "game"
159170
=== modified file 'hypernucleusserver/hypernucleusserver/viewlib/userlib.py'
--- hypernucleusserver/hypernucleusserver/viewlib/userlib.py 2010-12-11 20:46:28 +0000
+++ hypernucleusserver/hypernucleusserver/viewlib/userlib.py 2011-06-21 20:38:13 +0000
@@ -1,4 +1,6 @@
1from hypernucleusserver.models import DBSession, User, NoResultFound1from hypernucleusserver.models import DBSession
2from sqlalchemy.orm.exc import NoResultFound
3from hypernucleusserver.model.auth import User
24
3class UserNotFound(Exception):5class UserNotFound(Exception):
4 pass6 pass
57
=== modified file 'hypernucleusserver/hypernucleusserver/views/errwarninfo.py'
--- hypernucleusserver/hypernucleusserver/views/errwarninfo.py 2010-12-07 23:25:07 +0000
+++ hypernucleusserver/hypernucleusserver/views/errwarninfo.py 2011-06-21 20:38:13 +0000
@@ -1,9 +1,12 @@
1import json1import json
2from pyramid.url import route_url2from pyramid.url import route_url
3from string import Template3from string import Template
4from hypernucleusserver.models import DBSession, ErrWarnInfoInfo, NoResultFound4from hypernucleusserver.models import DBSession
5from hypernucleusserver.models import ErrWarnInfoError, ErrWarnInfoWarn5from hypernucleusserver.model.errwarninfo import ErrWarnInfoInfo
6from hypernucleusserver.model.errwarninfo import ErrWarnInfoError
7from hypernucleusserver.model.errwarninfo import ErrWarnInfoWarn
6from pyramid.httpexceptions import HTTPFound8from pyramid.httpexceptions import HTTPFound
9from sqlalchemy.orm.exc import NoResultFound
710
8notexisterr = u"errwarninfo_notexist"11notexisterr = u"errwarninfo_notexist"
9jsonerr = u"errwarninfo_json"12jsonerr = u"errwarninfo_json"
1013
=== modified file 'hypernucleusserver/hypernucleusserver/views/gamedep.py'
--- hypernucleusserver/hypernucleusserver/views/gamedep.py 2011-06-17 19:53:18 +0000
+++ hypernucleusserver/hypernucleusserver/views/gamedep.py 2011-06-21 20:38:13 +0000
@@ -1,10 +1,7 @@
1from hypernucleusserver.viewlib.userlib import UserLib1from hypernucleusserver.viewlib.userlib import UserLib
2from hypernucleusserver.viewlib.gamedeplib import GameDepLib, GameDepNotFound2from hypernucleusserver.viewlib.gamedeplib import GameDepLib, GameDepNotFound
3from hypernucleusserver.viewlib.helpers import error_redirect, get_username3from hypernucleusserver.viewlib.helpers import error_redirect
4from pyramid.httpexceptions import HTTPFound, HTTPNotFound4from pyramid.exceptions import NotFound
5from pyramid.exceptions import Forbidden, NotFound
6from pyramid.url import route_url
7from pyramid.security import has_permission
8from colander import MappingSchema, SchemaNode, String, Decimal, OneOf5from colander import MappingSchema, SchemaNode, String, Decimal, OneOf
9from deform import ValidationFailure, Form, FileData6from deform import ValidationFailure, Form, FileData
10from deform.widget import TextAreaWidget, TextInputWidget, RadioChoiceWidget, \7from deform.widget import TextAreaWidget, TextInputWidget, RadioChoiceWidget, \
@@ -47,12 +44,12 @@
47 pageid = request.matchdict.get('pageid')44 pageid = request.matchdict.get('pageid')
48 45
49 try:46 try:
50 dbpage, dbrevision = g.show(pageid)47 dbpage = g.show(pageid)[0]
51 dbdescription = dbpage.description48 dbdescription = dbpage.description
52 dbname = dbpage.name49 dbname = dbpage.name
53 dbdisplay_name = dbpage.display_name50 dbdisplay_name = dbpage.display_name
54 except GameDepNotFound:51 except GameDepNotFound:
55 dbpage, dbrevision = (None, None)52 dbpage = None
56 dbdescription = u""53 dbdescription = u""
57 dbname = u""54 dbname = u""
58 dbdisplay_name = u""55 dbdisplay_name = u""

Subscribers

People subscribed via source and target branches

to all changes: