diff options
author | Michael Elkins <melkins@tislabs.com> | 2012-01-17 05:03:48 +0000 |
---|---|---|
committer | Michael Elkins <melkins@tislabs.com> | 2012-01-17 05:03:48 +0000 |
commit | 3f82521d0f8dd5c5e1170ebc8d52e6f03735cab5 (patch) | |
tree | be58494560285799d9d5ca92c25ad471e4f15621 /rpkid/rpki/gui/app/timestamp.py | |
parent | a7c03e759d8c4fd0f7f29efdbcbf0f02deea757e (diff) |
create utility function for updating Timestamp objects
add missing copyright notices
svn path=/branches/tk161/; revision=4175
Diffstat (limited to 'rpkid/rpki/gui/app/timestamp.py')
-rw-r--r-- | rpkid/rpki/gui/app/timestamp.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/rpkid/rpki/gui/app/timestamp.py b/rpkid/rpki/gui/app/timestamp.py new file mode 100644 index 00000000..c460ff86 --- /dev/null +++ b/rpkid/rpki/gui/app/timestamp.py @@ -0,0 +1,22 @@ +# $Id$ +# Copyright (C) 2012 SPARTA, Inc. a Parsons Company +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND SPARTA DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL SPARTA BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. +# + +import models + +def update(name): + "Set the timestamp value for the given name to the current time." + obj, created = models.Timestamp.objects.get_or_create(name=name) + if not created: obj.save() # force update for existing objects |