Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
mentors.debian.net
debexpo
Commits
c95c9457
Commit
c95c9457
authored
Aug 16, 2012
by
Baptiste Mouterde
Committed by
ikoalaz
Aug 16, 2012
Browse files
comments: license stuff and moving to older db declaration
parent
64cf38dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
debexpo/model/package_comments.py
View file @
c95c9457
...
...
@@ -6,6 +6,7 @@
#
# Copyright © 2008 Jonny Lamb <jonny@debian.org>
# Copyright © 2012 Nicolas Dandrimont <nicolas.dandrimont@crans.org>
# 2012 Baptiste Mouterde <baptiste.mouterde@gmail.com>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
...
...
@@ -32,35 +33,36 @@
Holds package_comments table model.
"""
__author
s
__
=
'Jonny Lamb
, Nicolas Dandrimont
'
__copyright__
=
'Copyright © 2008 Jonny Lamb
, Copyright © 2012 Nicolas Dandrimont
'
__author__
=
'Jonny Lamb'
__copyright__
=
'Copyright © 2008 Jonny Lamb'
__license__
=
'MIT'
import
sqlalchemy
as
sa
from
sqlalchemy
import
orm
from
sqlalchemy.ext.declarative
import
declarative_base
from
debexpo.model
import
meta
,
OrmObject
from
debexpo.model.users
import
User
from
debexpo.model.package_versions
import
PackageVersion
Base
=
declarative_base
(
metadata
=
meta
.
metadata
)
t_package_comments
=
sa
.
Table
(
'package_comments'
,
meta
.
metadata
,
sa
.
Column
(
'id'
,
sa
.
types
.
Integer
,
primary_key
=
True
),
sa
.
Column
(
'user_id'
,
sa
.
types
.
Integer
,
sa
.
ForeignKey
(
'users.id'
)),
sa
.
Column
(
'package_version_id'
,
sa
.
types
.
Integer
,
sa
.
ForeignKey
(
'package_versions.id'
)),
sa
.
Column
(
'parent_id'
,
sa
.
types
.
Integer
,
sa
.
ForeignKey
(
'package_comments.id'
),
nullable
=
True
),
sa
.
Column
(
'text'
,
sa
.
types
.
Text
,
nullable
=
False
),
sa
.
Column
(
'time'
,
sa
.
types
.
DateTime
,
nullable
=
False
),
sa
.
Column
(
'start'
,
sa
.
types
.
Integer
,
nullable
=
True
),
sa
.
Column
(
'stop'
,
sa
.
types
.
Integer
,
nullable
=
True
),
sa
.
Column
(
'index'
,
sa
.
types
.
Integer
,
default
=
0
),
sa
.
Column
(
'style'
,
sa
.
types
.
String
(
10
),
default
=
'info'
),
sa
.
Column
(
'file'
,
sa
.
types
.
String
(
100
),
nullable
=
True
),
sa
.
Column
(
'score'
,
sa
.
types
.
Integer
,
default
=
0
)
)
class
PackageComment
(
Base
):
__tablename__
=
'package_comments'
id
=
sa
.
Column
(
sa
.
types
.
Integer
,
primary_key
=
True
)
user_id
=
sa
.
Column
(
sa
.
types
.
Integer
,
sa
.
ForeignKey
(
'users.id'
))
package_version_id
=
sa
.
Column
(
sa
.
types
.
Integer
,
sa
.
ForeignKey
(
'package_versions.id'
))
parent_id
=
sa
.
Column
(
sa
.
types
.
Integer
,
sa
.
ForeignKey
(
'package_comments.id'
))
text
=
sa
.
Column
(
sa
.
types
.
Text
,
nullable
=
False
)
time
=
sa
.
Column
(
sa
.
types
.
DateTime
,
nullable
=
False
)
start
=
sa
.
Column
(
sa
.
types
.
Integer
,
nullable
=
True
)
stop
=
sa
.
Column
(
sa
.
types
.
Integer
,
nullable
=
True
)
index
=
sa
.
Column
(
sa
.
types
.
Integer
,
default
=
0
)
style
=
sa
.
Column
(
sa
.
types
.
String
(
10
),
default
=
'info'
)
file
=
sa
.
Column
(
sa
.
types
.
String
(
100
),
nullable
=
True
)
score
=
sa
.
Column
(
sa
.
types
.
Integer
,
default
=
0
)
children
=
orm
.
relationship
(
'PackageComment'
,
backref
=
orm
.
backref
(
'parent'
,
remote_side
=
[
id
]),
)
class
PackageComment
(
OrmObject
):
foreign
=
[
'package_version'
,
'user'
]
orm
.
mapper
(
PackageComment
,
t_package_comments
,
properties
=
{
'package_version'
:
orm
.
relation
(
PackageVersion
,
backref
=
'package_comments'
),
'user'
:
orm
.
relation
(
User
,
backref
=
'package_comments'
),
})
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment