This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last): | |
File "/usr/local/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 273, in run | |
self.finish_response() | |
File "/usr/local/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 312, in finish_response | |
self.write(data) | |
File "/usr/local/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 389, in write | |
self.send_headers() | |
File "/usr/local/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 441, in send_headers | |
self.send_preamble() | |
File "/usr/local/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 372, in send_preamble |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CELERY_RESULT_BACKEND = "redis" | |
REDIS_HOST = "localhost" | |
REDIS_PORT = 6379 | |
REDIS_DB = 0 | |
BROKER_BACKEND = "redis" | |
BROKER_HOST = "localhost" # Maps to redis host. | |
BROKER_PORT = 6379 # Maps to redis port. | |
BROKER_VHOST = "0" # Maps to database number. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from celery.decorators import task | |
... | |
@task | |
def time_consuming_task(foo, bar): | |
# code here | |
return something # This function must return a value | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def __getattr__(self, key): | |
if key in ['prefix', 'id']: | |
return super(Model, self).__getattribute__(key) | |
else: | |
_key = "%s.%s" % (self.prefix, key) | |
if key in self._sets: | |
return get_set(_key) | |
elif key in self._lists: | |
return get_list(_key) | |
elif key in self._zsets: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rorm import * | |
class User(Model): | |
info = Field('hash') | |
followers = Field('set') | |
following = Field('set') | |
""" | |
>>> vivek = User.create() #Auto increment ids |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form> | |
<table width="400px"> | |
<tr> <td>First name</td> <td><input type="text" id="first"/></td></tr> | |
<tr> <td>Last name</td> <td> <input type="text" id="last"/></td> </tr> | |
<tr> <td>Email address</td> <td> <input type="text" id="email"/></td> </tr> | |
<tr> <td>Password</td> <td> <input type="password" id="pass"/></td> </tr> | |
<tr> <td> <input type="button" value="Submit" onclick="validateSubmit()"> </input> </td></tr> | |
<table> | |
</form> | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("form").submit(function () { | |
var status = Validators({ | |
"input": new EmptyValidator(), | |
"#email": new EmailValidator("Please enter a valid email address"), | |
"#pass": new LengthValidator(6, "The password should be atleast 6 characters") | |
}); | |
return status; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function foo(value) { | |
return value==42; | |
} | |
... | |
Validators({ | |
"#field_item": new ValueValidator("errorClass", | |
"This field is not the answer to life, the universe and everything", foo) | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validators({ | |
"#field_item": new RegexValidator("errorClass", | |
"Please enter a valid postal code", /^\d{5}$/) | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sendgrid(from_email, to_email, subject, message): | |
msg = MIMEText(message) | |
msg['Subject'] = subject | |
msg['From'] = from_email | |
msg['To'] = to_email | |
# Login credentials to sendgrid | |
username = '**********' | |
password = "**********" | |
OlderNewer