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
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
# | |
# Use this file to build your own SSCCE | |
# SSCCE = Short, Self Contained, Correct (Compatible) Example | |
# see http://sscce.org/ | |
# | |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
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
"""This explains some object interfaces used in validator.py | |
""" | |
class _DatabaseObject(object): | |
pass | |
class _Relationship(object): | |
pass |
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
This bug report is being automatically closed because it did not meet one or more common-sense | |
and industry-standard reporting requirements. | |
Exact reasons have been marked below. If you can correct this, feel free to re-open. | |
___ The issue is not related to this library, but is a general issue with basic: | |
___ Python | |
___ Sql | |
___ The issue is not actually disclosed inline, but linked to an offsite article: | |
___ The issue is disclosed on StackOverflow. |
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 _php_var_dump(data,depth=0): | |
padding= " "*depth | |
keypadding= " "*(depth+1) | |
depth+= 1 | |
if type(data) == types.DictType : | |
items = [] | |
for i in data : | |
item = keypadding + "'%s' => %s" % (i,_php_var_dump(data[i],depth=depth)) | |
items.append(item) | |
items = ',\n'.join(items) |
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
Python MonogoDB integration, based on http://docs.pylonsproject.org/projects/pyramid_cookbook/en/latest/mongo.html | |
I'm migrating a few projects to use mongodb, and I found this to be the easiest way to maintain across all projects ( as in, i don't have to change any code outside of .ini files ) | |
1. the main() routin in __init__.py just needs to call subscribers.mongodb.initialize_mongo_db() | |
2. subscribers has a single file called mongodb, which initializes | |
3. environment.ini has its own mongodb space. setting mongodb_use to 'true' will initialize it, setting it to anything else will ignore it. |
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
""" | |
v 0.0.3 | |
a port of some classic pylons styling, but without much of the cruft that was not used often | |
This allows for a very particular coding style, which i prefer. | |
As you can see below, 'methods' are broken into multiple parts: |
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 main(global_config, **settings): | |
... | |
config.add_subscriber(\ | |
'myApp.subscribers.deform_static_prep', | |
'pyramid.events.ApplicationCreated') | |
... |
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
Choose a username. You can't post until you do! | |
<form method="post" action="/account/choose-username"> | |
<input type="text" name="username" value="" id="username_selector"/> | |
<span id="fieldstatus-username"></span> | |
</form> | |
<script> | |
// on all keyups, set a message that the username is bad or that you're checking | |
// however, don't actually check until you have a timeout - e.g. .6 seconds | |
// there's no point on taxing a server to repeatedly check |
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 main(global_config,**settings): | |
... | |
config.add_subscriber(\ | |
'myApp.subscribers.cookiexfer_new_request', | |
'pyramid.events.NewRequest') | |
config.add_subscriber(\ | |
'myApp.subscribers.cookiexfer_new_response', | |
'pyramid.events.NewResponse') | |
... |
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
""" | |
Simple module to ease form handling with ``Deform``. The provided | |
``FormGenerator`` class handles repetitive tasks like validation, | |
xhr requests, and recovering from exceptions thrown by the model. | |
### Begin example scenario: Adding a new user | |
from myschemas import UserSchema | |
from formgenerator import ( |