Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
a9183704
Commit
a9183704
authored
Feb 28, 2013
by
Giorgos Korfiatis
Browse files
wip Remove CallSerial model and related calls
parent
292e2022
Changes
2
Hide whitespace changes
Inline
Side-by-side
snf-astakos-app/astakos/quotaholder/callpoint.py
View file @
a9183704
...
...
@@ -44,10 +44,10 @@ from astakos.quotaholder.api import QH_PRACTICALLY_INFINITE
from
django.db.models
import
Q
,
Count
from
django.db.models
import
Q
from
.models
import
(
Policy
,
Holding
,
Commission
,
Provision
,
ProvisionLog
,
CallSerial
,
Commission
,
Provision
,
ProvisionLog
,
now
,
db_get_holding
,
db_get_policy
,
db_get_commission
,
db_filter_provision
,
db_get_callserial
)
db_get_commission
,
db_filter_provision
)
class
QuotaholderDjangoDBCallpoint
(
object
):
...
...
@@ -345,22 +345,11 @@ class QuotaholderDjangoDBCallpoint(object):
return
rejected
def
add_quota
(
self
,
context
=
None
,
clientkey
=
None
,
serial
=
None
,
context
=
None
,
sub_quota
=
(),
add_quota
=
()):
rejected
=
[]
append
=
rejected
.
append
if
serial
is
not
None
:
if
clientkey
is
None
:
all_pairs
=
[(
q
[
0
],
q
[
1
])
for
q
in
sub_quota
+
add_quota
]
raise
QuotaholderError
(
all_pairs
)
try
:
cs
=
CallSerial
.
objects
.
get
(
serial
=
serial
,
clientkey
=
clientkey
)
all_pairs
=
[(
q
[
0
],
q
[
1
])
for
q
in
sub_quota
+
add_quota
]
raise
QuotaholderError
(
all_pairs
)
except
CallSerial
.
DoesNotExist
:
pass
sources
=
sub_quota
+
add_quota
q_holdings
=
Q
()
holders
=
[]
...
...
@@ -431,44 +420,8 @@ class QuotaholderDjangoDBCallpoint(object):
if
rejected
:
raise
QuotaholderError
(
rejected
)
if
serial
is
not
None
and
clientkey
is
not
None
:
CallSerial
.
objects
.
create
(
serial
=
serial
,
clientkey
=
clientkey
)
return
rejected
def
ack_serials
(
self
,
context
=
None
,
clientkey
=
None
,
serials
=
()):
if
clientkey
is
None
:
return
for
serial
in
serials
:
try
:
c
=
db_get_callserial
(
clientkey
=
clientkey
,
serial
=
serial
,
for_update
=
True
)
c
.
delete
()
except
CallSerial
.
DoesNotExist
:
pass
return
def
query_serials
(
self
,
context
=
None
,
clientkey
=
None
,
serials
=
()):
result
=
[]
append
=
result
.
append
if
clientkey
is
None
:
return
result
if
not
serials
:
cs
=
CallSerial
.
objects
.
filter
(
clientkey
=
clientkey
)
return
[
c
.
serial
for
c
in
cs
]
for
serial
in
serials
:
try
:
db_get_callserial
(
clientkey
=
clientkey
,
serial
=
serial
)
append
(
serial
)
except
CallSerial
.
DoesNotExist
:
pass
return
result
def
issue_commission
(
self
,
context
=
None
,
clientkey
=
None
,
...
...
snf-astakos-app/astakos/quotaholder/models.py
View file @
a9183704
...
...
@@ -170,16 +170,6 @@ class ProvisionLog(Model):
def
target_outbound
(
self
):
return
self
.
target_outbound_through
()
+
self
.
target_exported
class
CallSerial
(
Model
):
serial
=
BigIntegerField
(
null
=
False
)
clientkey
=
CharField
(
max_length
=
4096
,
null
=
False
)
objects
=
ForUpdateManager
()
class
Meta
:
unique_together
=
((
'serial'
,
'clientkey'
),)
def
_get
(
*
args
,
**
kwargs
):
model
=
args
[
0
]
...
...
@@ -211,8 +201,5 @@ def db_get_policy(*args, **kwargs):
def
db_get_commission
(
*
args
,
**
kwargs
):
return
_get
(
Commission
,
*
args
,
**
kwargs
)
def
db_get_callserial
(
*
args
,
**
kwargs
):
return
_get
(
CallSerial
,
*
args
,
**
kwargs
)
def
db_filter_provision
(
*
args
,
**
kwargs
):
return
_filter
(
Provision
,
*
args
,
**
kwargs
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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