[snowy] Moving _create_uuid() to snowy.core.utils so it can be used elsewhere
- From: Jeff Schroeder <jschroeder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [snowy] Moving _create_uuid() to snowy.core.utils so it can be used elsewhere
- Date: Sun, 7 Nov 2010 18:21:08 +0000 (UTC)
commit d980abc1a0e7196d59a6c35217cb9a4475c9d6e1
Author: Jeff Schroeder <jeffschroeder computer org>
Date: Sun Nov 7 12:11:43 2010 -0800
Moving _create_uuid() to snowy.core.utils so it can be used elsewhere
accounts/models.py | 7 ++-----
core/utils.py | 21 +++++++++++++++++++++
2 files changed, 23 insertions(+), 5 deletions(-)
---
diff --git a/accounts/models.py b/accounts/models.py
index 82325fb..5683a20 100644
--- a/accounts/models.py
+++ b/accounts/models.py
@@ -21,15 +21,12 @@ from django.contrib.auth.models import User
from django.conf import settings
from django.db import models
-import uuid
+from snowy.core.utils import create_uuid
class UserProfile(models.Model):
- def _create_uuid():
- return str(uuid.uuid4())
-
user = models.ForeignKey(User, unique=True)
latest_sync_rev = models.IntegerField(default=-1)
- current_sync_uuid = models.CharField(max_length=36, default=_create_uuid)
+ current_sync_uuid = models.CharField(max_length=36, default=create_uuid)
language = models.CharField(max_length=5, choices=settings.LANGUAGES,
verbose_name=_(u'Application Language'),
null=True, blank=True)
diff --git a/core/utils.py b/core/utils.py
new file mode 100644
index 0000000..4effae1
--- /dev/null
+++ b/core/utils.py
@@ -0,0 +1,21 @@
+#
+# Copyright (c) 2010 Jeff Schroeder <jeffschroeder computer org>
+#
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Affero General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+import uuid
+
+def create_uuid():
+ return str(uuid.uuid4())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]