rabin 7 years ago
parent
commit
584a54297f
2 changed files with 7 additions and 3 deletions
  1. 5 1
      core.py
  2. 2 2
      service.py

+ 5 - 1
core.py

@@ -158,7 +158,11 @@ class Demeter(object):
 		for i in xrange(length):
 			salt += chars[rand(0, len_chars)]
 		return salt
-
+	@staticmethod
+	def hour(value):
+		if value < 10:
+			return '0' + str(value)
+		return value
 	@staticmethod
 	def time():
 		return int(time.time())

+ 2 - 2
service.py

@@ -39,11 +39,11 @@ class Service(object):
 		return data
 
 	# 更新
-	def update(self, name, id, data):
+	def update(self, name, id, data, cdate=True):
 		model = self.model(name)
 		if id:
 			model.id = id
-			if 'cdate' not in data:
+			if cdate == True and 'cdate' not in data:
 				data['cdate'] = 'time'
 			model.update(data)
 			return id