Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
0dba3a9f
authored
Jul 27, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix-notifications' into 'master'
Fix Notifications
parents
03e2895c
eee83e3a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
circle/dashboard/models.py
+1
-1
circle/vm/models/instance.py
+11
-4
No files found.
circle/dashboard/models.py
View file @
0dba3a9f
...
...
@@ -70,7 +70,7 @@ class Notification(TimeStampedModel):
def
send
(
cls
,
user
,
subject
,
template
,
context
,
valid_until
=
None
,
subject_context
=
None
):
hro
=
create_readable
(
template
,
user
=
user
,
**
context
)
subject
=
create_readable
(
subject
,
subject_context
or
context
)
subject
=
create_readable
(
subject
,
**
(
subject_context
or
context
)
)
return
cls
.
objects
.
create
(
to
=
user
,
subject_data
=
subject
.
to_dict
(),
message_data
=
hro
.
to_dict
(),
...
...
circle/vm/models/instance.py
View file @
0dba3a9f
...
...
@@ -642,6 +642,13 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
:param again: Notify already notified owners.
"""
notification_msg
=
ugettext_noop
(
'Your instance <a href="
%(url)
s">
%(instance)
s</a> is going to '
'expire. It will be suspended at
%(suspend)
s and destroyed at '
'
%(delete)
s. Please, either <a href="
%(token)
s">renew</a> '
'or <a href="
%(url)
s">destroy</a> it now.'
)
if
not
again
and
self
.
_is_notified_about_expiration
():
return
False
success
,
failed
=
[],
[]
...
...
@@ -672,10 +679,10 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
try
:
token
=
VmRenewView
.
get_token_url
(
self
,
u
)
u
.
profile
.
notify
(
_
(
'
%
s expiring soon'
)
%
unicode
(
self
),
'dashboard/notifications/vm-expiring.html'
,
{
'instance'
:
self
,
'token'
:
token
},
valid_until
=
min
(
self
.
time_of_delete
,
self
.
time_of_suspend
)
)
ugettext_noop
(
'
%(instance)
s expiring soon'
),
notification_msg
,
url
=
self
.
get_absolute_url
()
,
instance
=
self
,
suspend
=
self
.
time_of_suspend
,
token
=
token
,
delete
=
self
.
time_of_delete
)
except
Exception
as
e
:
failed
.
append
((
u
,
e
))
else
:
...
...
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