rabin 7 years ago
parent
commit
1234ae3359
2 changed files with 10 additions and 0 deletions
  1. 8 0
      core.py
  2. 2 0
      model.py

+ 8 - 0
core.py

@@ -238,6 +238,14 @@ class Demeter(object):
 			value = str(eval(exp))
 		return value
 
+	@classmethod
+	def curl(self, url):
+		module = __import__('tornado')
+		http = getattr(module, 'httpclient')
+		http_client = http.HTTPClient()
+		response = http_client.fetch(url)
+		return response
+
 	@classmethod
 	def error(self, string):
 		if self.request:

+ 2 - 0
model.py

@@ -162,6 +162,8 @@ class Model(object):
 		Counter().unset()
 
 	def check(self, field, val, attr):
+		if val == 'undefined':
+			self.error(error)
 		if attr.match == 'not':
 			if not val:
 				self.error(field + ' not exists')