Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 1 | |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 3 | <html><head><title>Python: module oauth2client.appengine</title> |
| 4 | </head><body bgcolor="#f0f0f8"> |
| 5 | |
| 6 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> |
| 7 | <tr bgcolor="#7799ee"> |
| 8 | <td valign=bottom> <br> |
| 9 | <font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="oauth2client.html"><font color="#ffffff">oauth2client</font></a>.appengine</strong></big></big></font></td |
| 10 | ><td align=right valign=bottom |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame^] | 11 | ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/usr/local/google/home/jcgregorio/projects/apiclient/oauth2client/appengine.py">/usr/local/google/home/jcgregorio/projects/apiclient/oauth2client/appengine.py</a></font></td></tr></table> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 12 | <p><tt>Utilities for Google App Engine<br> |
| 13 | <br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 14 | Utilities for making it easier to use OAuth 2.0 on Google App Engine.</tt></p> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 15 | <p> |
| 16 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 17 | <tr bgcolor="#aa55cc"> |
| 18 | <td colspan=3 valign=bottom> <br> |
| 19 | <font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr> |
| 20 | |
| 21 | <tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 22 | <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="google.appengine.api.app_identity.app_identity.html">google.appengine.api.app_identity.app_identity</a><br> |
| 23 | <a href="base64.html">base64</a><br> |
| 24 | <a href="google.appengine.ext.db.html">google.appengine.ext.db</a><br> |
| 25 | </td><td width="25%" valign=top><a href="httplib2.html">httplib2</a><br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 26 | <a href="google.appengine.api.memcache.html">google.appengine.api.memcache</a><br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame^] | 27 | <a href="pickle.html">pickle</a><br> |
| 28 | </td><td width="25%" valign=top><a href="simplejson.html">simplejson</a><br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 29 | <a href="time.html">time</a><br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame^] | 30 | <a href="google.appengine.api.users.html">google.appengine.api.users</a><br> |
| 31 | </td><td width="25%" valign=top><a href="google.appengine.ext.webapp.html">google.appengine.ext.webapp</a><br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 32 | </td></tr></table></td></tr></table><p> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 33 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 34 | <tr bgcolor="#ee77aa"> |
| 35 | <td colspan=3 valign=bottom> <br> |
| 36 | <font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr> |
| 37 | |
| 38 | <tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td> |
| 39 | <td width="100%"><dl> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 40 | <dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a> |
| 41 | </font></dt><dd> |
| 42 | <dl> |
| 43 | <dt><font face="helvetica, arial"><a href="oauth2client.appengine.html#OAuth2Decorator">OAuth2Decorator</a> |
| 44 | </font></dt></dl> |
| 45 | </dd> |
| 46 | <dt><font face="helvetica, arial"><a href="google.appengine.ext.db.html#Model">google.appengine.ext.db.Model</a>(<a href="__builtin__.html#object">__builtin__.object</a>) |
| 47 | </font></dt><dd> |
| 48 | <dl> |
| 49 | <dt><font face="helvetica, arial"><a href="oauth2client.appengine.html#CredentialsModel">CredentialsModel</a> |
| 50 | </font></dt></dl> |
| 51 | </dd> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 52 | <dt><font face="helvetica, arial"><a href="google.appengine.ext.db.html#Property">google.appengine.ext.db.Property</a>(<a href="__builtin__.html#object">__builtin__.object</a>) |
| 53 | </font></dt><dd> |
| 54 | <dl> |
| 55 | <dt><font face="helvetica, arial"><a href="oauth2client.appengine.html#CredentialsProperty">CredentialsProperty</a> |
| 56 | </font></dt><dt><font face="helvetica, arial"><a href="oauth2client.appengine.html#FlowProperty">FlowProperty</a> |
| 57 | </font></dt></dl> |
| 58 | </dd> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 59 | <dt><font face="helvetica, arial"><a href="google.appengine.ext.webapp.html#RequestHandler">google.appengine.ext.webapp.RequestHandler</a>(<a href="__builtin__.html#object">__builtin__.object</a>) |
| 60 | </font></dt><dd> |
| 61 | <dl> |
| 62 | <dt><font face="helvetica, arial"><a href="oauth2client.appengine.html#OAuth2Handler">OAuth2Handler</a> |
| 63 | </font></dt></dl> |
| 64 | </dd> |
| 65 | <dt><font face="helvetica, arial"><a href="oauth2client.client.html#AssertionCredentials">oauth2client.client.AssertionCredentials</a>(<a href="oauth2client.client.html#OAuth2Credentials">oauth2client.client.OAuth2Credentials</a>) |
| 66 | </font></dt><dd> |
| 67 | <dl> |
| 68 | <dt><font face="helvetica, arial"><a href="oauth2client.appengine.html#AppAssertionCredentials">AppAssertionCredentials</a> |
| 69 | </font></dt></dl> |
| 70 | </dd> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 71 | <dt><font face="helvetica, arial"><a href="oauth2client.client.html#Storage">oauth2client.client.Storage</a>(<a href="__builtin__.html#object">__builtin__.object</a>) |
| 72 | </font></dt><dd> |
| 73 | <dl> |
| 74 | <dt><font face="helvetica, arial"><a href="oauth2client.appengine.html#StorageByKeyName">StorageByKeyName</a> |
| 75 | </font></dt></dl> |
| 76 | </dd> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 77 | </dl> |
| 78 | <p> |
| 79 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 80 | <tr bgcolor="#ffc8d8"> |
| 81 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 82 | <font color="#000000" face="helvetica, arial"><a name="AppAssertionCredentials">class <strong>AppAssertionCredentials</strong></a>(<a href="oauth2client.client.html#AssertionCredentials">oauth2client.client.AssertionCredentials</a>)</font></td></tr> |
| 83 | |
| 84 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 85 | <td colspan=2><tt>Credentials <a href="__builtin__.html#object">object</a> for App Engine Assertion Grants<br> |
| 86 | <br> |
| 87 | This <a href="__builtin__.html#object">object</a> will allow an App Engine application to identify itself to Google<br> |
| 88 | and other OAuth 2.0 servers that can verify assertions. It can be used for<br> |
| 89 | the purpose of accessing data stored under an account assigned to the App<br> |
| 90 | Engine application itself. The algorithm used for generating the assertion is<br> |
| 91 | the Signed JSON Web Token (JWT) algorithm. Additional details can be found at<br> |
| 92 | the following link:<br> |
| 93 | <br> |
| 94 | <a href="http://self-issued.info/docs/draft-jones-json-web-token.html">http://self-issued.info/docs/draft-jones-json-web-token.html</a><br> |
| 95 | <br> |
| 96 | This credential does not require a flow to instantiate because it represents<br> |
| 97 | a two legged flow, and therefore has all of the required information to<br> |
| 98 | generate and refresh its own access tokens.<br> |
| 99 | <br> |
| 100 | AssertionFlowCredentials objects may be safely pickled and unpickled.<br> </tt></td></tr> |
| 101 | <tr><td> </td> |
| 102 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 103 | <dd><a href="oauth2client.appengine.html#AppAssertionCredentials">AppAssertionCredentials</a></dd> |
| 104 | <dd><a href="oauth2client.client.html#AssertionCredentials">oauth2client.client.AssertionCredentials</a></dd> |
| 105 | <dd><a href="oauth2client.client.html#OAuth2Credentials">oauth2client.client.OAuth2Credentials</a></dd> |
| 106 | <dd><a href="oauth2client.client.html#Credentials">oauth2client.client.Credentials</a></dd> |
| 107 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 108 | </dl> |
| 109 | <hr> |
| 110 | Methods defined here:<br> |
Joe Gregorio | 0250385 | 2011-08-31 09:07:55 -0400 | [diff] [blame] | 111 | <dl><dt><a name="AppAssertionCredentials-__init__"><strong>__init__</strong></a>(self, scope, audience<font color="#909090">='https://accounts.google.com/o/oauth2/token'</font>, assertion_type<font color="#909090">='http://oauth.net/grant_type/jwt/1.0/bearer'</font>, token_uri<font color="#909090">='https://accounts.google.com/o/oauth2/token'</font>, **kwargs)</dt><dd><tt>Constructor for <a href="#AppAssertionCredentials">AppAssertionCredentials</a><br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 112 | <br> |
| 113 | Args:<br> |
| 114 | scope: string, scope of the credentials being requested.<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 115 | audience: string, The audience, or verifier of the assertion. For<br> |
| 116 | convenience defaults to Google's audience.<br> |
| 117 | assertion_type: string, Type name that will identify the format of the<br> |
| 118 | assertion string. For convience, defaults to the JSON Web Token (JWT)<br> |
| 119 | assertion type string.<br> |
| 120 | token_uri: string, URI for token endpoint. For convenience<br> |
| 121 | defaults to Google's endpoints but any OAuth 2.0 provider can be used.</tt></dd></dl> |
| 122 | |
| 123 | <hr> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame^] | 124 | Class methods defined here:<br> |
| 125 | <dl><dt><a name="AppAssertionCredentials-from_json"><strong>from_json</strong></a>(cls, json)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt></dl> |
| 126 | |
| 127 | <hr> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 128 | Methods inherited from <a href="oauth2client.client.html#OAuth2Credentials">oauth2client.client.OAuth2Credentials</a>:<br> |
| 129 | <dl><dt><a name="AppAssertionCredentials-__getstate__"><strong>__getstate__</strong></a>(self)</dt><dd><tt>Trim the state down to something that can be pickled.</tt></dd></dl> |
| 130 | |
| 131 | <dl><dt><a name="AppAssertionCredentials-__setstate__"><strong>__setstate__</strong></a>(self, state)</dt><dd><tt>Reconstitute the state of the <a href="__builtin__.html#object">object</a> from being pickled.</tt></dd></dl> |
| 132 | |
| 133 | <dl><dt><a name="AppAssertionCredentials-authorize"><strong>authorize</strong></a>(self, http)</dt><dd><tt>Authorize an httplib2.Http instance with these credentials.<br> |
| 134 | <br> |
| 135 | Args:<br> |
| 136 | http: An instance of httplib2.Http<br> |
| 137 | or something that acts like it.<br> |
| 138 | <br> |
| 139 | Returns:<br> |
| 140 | A modified instance of http that was passed in.<br> |
| 141 | <br> |
| 142 | Example:<br> |
| 143 | <br> |
| 144 | h = httplib2.Http()<br> |
| 145 | h = credentials.<a href="#AppAssertionCredentials-authorize">authorize</a>(h)<br> |
| 146 | <br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame^] | 147 | You can't create a new OAuth subclass of httplib2.Authenication<br> |
| 148 | because it never gets passed the absolute URI, which is needed for<br> |
| 149 | signing. So instead we have to overload 'request' with a closure<br> |
| 150 | that adds in the Authorization header and then calls the original<br> |
| 151 | version of 'request()'.</tt></dd></dl> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 152 | |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame^] | 153 | <dl><dt><a name="AppAssertionCredentials-set_store"><strong>set_store</strong></a>(self, store)</dt><dd><tt>Set the <a href="oauth2client.client.html#Storage">Storage</a> for the credential.<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 154 | <br> |
| 155 | Args:<br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame^] | 156 | store: <a href="oauth2client.client.html#Storage">Storage</a>, an implementation of Stroage <a href="__builtin__.html#object">object</a>.<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 157 | This is needed to store the latest access_token if it<br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame^] | 158 | has expired and been refreshed. This implementation uses<br> |
| 159 | locking to check for updates before updating the<br> |
| 160 | access_token.</tt></dd></dl> |
| 161 | |
| 162 | <dl><dt><a name="AppAssertionCredentials-to_json"><strong>to_json</strong></a>(self)</dt></dl> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 163 | |
| 164 | <hr> |
| 165 | Data descriptors inherited from <a href="oauth2client.client.html#OAuth2Credentials">oauth2client.client.OAuth2Credentials</a>:<br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame^] | 166 | <dl><dt><strong>access_token_expired</strong></dt> |
| 167 | <dd><tt>True if the credential is expired or invalid.<br> |
| 168 | <br> |
| 169 | If the token_expiry isn't set, we assume the token doesn't expire.</tt></dd> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 170 | </dl> |
| 171 | <hr> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame^] | 172 | Class methods inherited from <a href="oauth2client.client.html#Credentials">oauth2client.client.Credentials</a>:<br> |
| 173 | <dl><dt><a name="AppAssertionCredentials-new_from_json"><strong>new_from_json</strong></a>(cls, s)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Utility class method to instantiate a Credentials subclass from a JSON<br> |
| 174 | representation produced by <a href="#AppAssertionCredentials-to_json">to_json</a>().<br> |
| 175 | <br> |
| 176 | Args:<br> |
| 177 | s: string, JSON from <a href="#AppAssertionCredentials-to_json">to_json</a>().<br> |
| 178 | <br> |
| 179 | Returns:<br> |
| 180 | An instance of the subclass of Credentials that was serialized with<br> |
| 181 | <a href="#AppAssertionCredentials-to_json">to_json</a>().</tt></dd></dl> |
| 182 | |
| 183 | <hr> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 184 | Data descriptors inherited from <a href="oauth2client.client.html#Credentials">oauth2client.client.Credentials</a>:<br> |
| 185 | <dl><dt><strong>__dict__</strong></dt> |
| 186 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 187 | </dl> |
| 188 | <dl><dt><strong>__weakref__</strong></dt> |
| 189 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 190 | </dl> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame^] | 191 | <hr> |
| 192 | Data and other attributes inherited from <a href="oauth2client.client.html#Credentials">oauth2client.client.Credentials</a>:<br> |
| 193 | <dl><dt><strong>NON_SERIALIZED_MEMBERS</strong> = ['store']</dl> |
| 194 | |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 195 | </td></tr></table> <p> |
| 196 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 197 | <tr bgcolor="#ffc8d8"> |
| 198 | <td colspan=3 valign=bottom> <br> |
| 199 | <font color="#000000" face="helvetica, arial"><a name="CredentialsModel">class <strong>CredentialsModel</strong></a>(<a href="google.appengine.ext.db.html#Model">google.appengine.ext.db.Model</a>)</font></td></tr> |
| 200 | |
| 201 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 202 | <td colspan=2><tt><a href="oauth2client.client.html#Storage">Storage</a> for OAuth 2.0 Credentials<br> |
| 203 | <br> |
| 204 | <a href="oauth2client.client.html#Storage">Storage</a> of the model is keyed by the user.user_id().<br> </tt></td></tr> |
| 205 | <tr><td> </td> |
| 206 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 207 | <dd><a href="oauth2client.appengine.html#CredentialsModel">CredentialsModel</a></dd> |
| 208 | <dd><a href="google.appengine.ext.db.html#Model">google.appengine.ext.db.Model</a></dd> |
| 209 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 210 | </dl> |
| 211 | <hr> |
| 212 | Data descriptors defined here:<br> |
| 213 | <dl><dt><strong>credentials</strong></dt> |
| 214 | <dd><tt>App Engine datastore Property for Credentials.<br> |
| 215 | <br> |
| 216 | Utility property that allows easy storage and retrieval of<br> |
| 217 | oath2client.Credentials</tt></dd> |
| 218 | </dl> |
| 219 | <hr> |
| 220 | Methods inherited from <a href="google.appengine.ext.db.html#Model">google.appengine.ext.db.Model</a>:<br> |
| 221 | <dl><dt><a name="CredentialsModel-__init__"><strong>__init__</strong></a>(self, parent<font color="#909090">=None</font>, key_name<font color="#909090">=None</font>, _app<font color="#909090">=None</font>, _from_entity<font color="#909090">=False</font>, **kwds)</dt><dd><tt>Creates a new instance of this model.<br> |
| 222 | <br> |
| 223 | To create a new entity, you instantiate a model and then call <a href="#CredentialsModel-put">put</a>(),<br> |
| 224 | which saves the entity to the datastore:<br> |
| 225 | <br> |
| 226 | person = Person()<br> |
| 227 | person.name = 'Bret'<br> |
| 228 | person.<a href="#CredentialsModel-put">put</a>()<br> |
| 229 | <br> |
| 230 | You can initialize properties in the model in the constructor with keyword<br> |
| 231 | arguments:<br> |
| 232 | <br> |
| 233 | person = Person(name='Bret')<br> |
| 234 | <br> |
| 235 | We initialize all other properties to the default value (as defined by the<br> |
| 236 | properties in the model definition) if they are not provided in the<br> |
| 237 | constructor.<br> |
| 238 | <br> |
| 239 | Args:<br> |
| 240 | parent: Parent instance for this instance or None, indicating a top-<br> |
| 241 | level instance.<br> |
| 242 | key_name: Name for new model instance.<br> |
| 243 | _from_entity: Intentionally undocumented.<br> |
| 244 | kwds: Keyword arguments mapping to properties of model. Also:<br> |
| 245 | key: Key instance for this instance, if provided makes parent and<br> |
| 246 | key_name redundant (they do not need to be set but if they are<br> |
| 247 | they must match the key).</tt></dd></dl> |
| 248 | |
| 249 | <dl><dt><a name="CredentialsModel-delete"><strong>delete</strong></a>(self, **kwargs)</dt><dd><tt>Deletes this entity from the datastore.<br> |
| 250 | <br> |
| 251 | Args:<br> |
| 252 | config: datastore_rpc.Configuration to use for this request.<br> |
| 253 | <br> |
| 254 | Raises:<br> |
| 255 | TransactionFailedError if the data could not be committed.</tt></dd></dl> |
| 256 | |
| 257 | <dl><dt><a name="CredentialsModel-dynamic_properties"><strong>dynamic_properties</strong></a>(self)</dt><dd><tt>Returns a list of all dynamic properties defined for instance.</tt></dd></dl> |
| 258 | |
| 259 | <dl><dt><a name="CredentialsModel-has_key"><strong>has_key</strong></a>(self)</dt><dd><tt>Determine if this model instance has a complete key.<br> |
| 260 | <br> |
| 261 | When not using a fully self-assigned Key, ids are not assigned until the<br> |
| 262 | data is saved to the Datastore, but instances with a key name always have<br> |
| 263 | a full key.<br> |
| 264 | <br> |
| 265 | Returns:<br> |
| 266 | True if the <a href="__builtin__.html#object">object</a> has been persisted to the datastore or has a key<br> |
| 267 | or has a key_name, otherwise False.</tt></dd></dl> |
| 268 | |
| 269 | <dl><dt><a name="CredentialsModel-instance_properties"><strong>instance_properties</strong></a>(self)</dt><dd><tt>Alias for dyanmic_properties.</tt></dd></dl> |
| 270 | |
| 271 | <dl><dt><a name="CredentialsModel-is_saved"><strong>is_saved</strong></a>(self)</dt><dd><tt>Determine if entity is persisted in the datastore.<br> |
| 272 | <br> |
| 273 | New instances of <a href="google.appengine.ext.db.html#Model">Model</a> do not start out saved in the data. Objects which<br> |
| 274 | are saved to or loaded from the Datastore will have a True saved state.<br> |
| 275 | <br> |
| 276 | Returns:<br> |
| 277 | True if <a href="__builtin__.html#object">object</a> has been persisted to the datastore, otherwise False.</tt></dd></dl> |
| 278 | |
| 279 | <dl><dt><a name="CredentialsModel-key"><strong>key</strong></a>(self)</dt><dd><tt>Unique key for this entity.<br> |
| 280 | <br> |
| 281 | This property is only available if this entity is already stored in the<br> |
| 282 | datastore or if it has a full key, so it is available if this entity was<br> |
| 283 | fetched returned from a query, or after <a href="#CredentialsModel-put">put</a>() is called the first time<br> |
| 284 | for new entities, or if a complete key was given when constructed.<br> |
| 285 | <br> |
| 286 | Returns:<br> |
| 287 | Datastore key of persisted entity.<br> |
| 288 | <br> |
| 289 | Raises:<br> |
| 290 | NotSavedError when entity is not persistent.</tt></dd></dl> |
| 291 | |
| 292 | <dl><dt><a name="CredentialsModel-parent"><strong>parent</strong></a>(self)</dt><dd><tt>Get the parent of the model instance.<br> |
| 293 | <br> |
| 294 | Returns:<br> |
| 295 | Parent of contained entity or parent provided in constructor, None if<br> |
| 296 | instance has no parent.</tt></dd></dl> |
| 297 | |
| 298 | <dl><dt><a name="CredentialsModel-parent_key"><strong>parent_key</strong></a>(self)</dt><dd><tt>Get the parent's key.<br> |
| 299 | <br> |
| 300 | This method is useful for avoiding a potential fetch from the datastore<br> |
| 301 | but still get information about the instances parent.<br> |
| 302 | <br> |
| 303 | Returns:<br> |
| 304 | Parent key of entity, None if there is no parent.</tt></dd></dl> |
| 305 | |
| 306 | <dl><dt><a name="CredentialsModel-put"><strong>put</strong></a>(self, **kwargs)</dt><dd><tt>Writes this model instance to the datastore.<br> |
| 307 | <br> |
| 308 | If this instance is new, we add an entity to the datastore.<br> |
| 309 | Otherwise, we update this instance, and the key will remain the<br> |
| 310 | same.<br> |
| 311 | <br> |
| 312 | Args:<br> |
| 313 | config: datastore_rpc.Configuration to use for this request.<br> |
| 314 | <br> |
| 315 | Returns:<br> |
| 316 | The key of the instance (either the existing key or a new key).<br> |
| 317 | <br> |
| 318 | Raises:<br> |
| 319 | TransactionFailedError if the data could not be committed.</tt></dd></dl> |
| 320 | |
| 321 | <dl><dt><a name="CredentialsModel-save"><strong>save</strong></a> = put(self, **kwargs)</dt><dd><tt>Writes this model instance to the datastore.<br> |
| 322 | <br> |
| 323 | If this instance is new, we add an entity to the datastore.<br> |
| 324 | Otherwise, we update this instance, and the key will remain the<br> |
| 325 | same.<br> |
| 326 | <br> |
| 327 | Args:<br> |
| 328 | config: datastore_rpc.Configuration to use for this request.<br> |
| 329 | <br> |
| 330 | Returns:<br> |
| 331 | The key of the instance (either the existing key or a new key).<br> |
| 332 | <br> |
| 333 | Raises:<br> |
| 334 | TransactionFailedError if the data could not be committed.</tt></dd></dl> |
| 335 | |
| 336 | <dl><dt><a name="CredentialsModel-to_xml"><strong>to_xml</strong></a>(self, _entity_class<font color="#909090">=<class 'google.appengine.api.datastore.Entity'></font>)</dt><dd><tt>Generate an XML representation of this model instance.<br> |
| 337 | <br> |
| 338 | atom and gd:namespace properties are converted to XML according to their<br> |
| 339 | respective schemas. For more information, see:<br> |
| 340 | <br> |
| 341 | <a href="http://www.atomenabled.org/developers/syndication/">http://www.atomenabled.org/developers/syndication/</a><br> |
| 342 | <a href="http://code.google.com/apis/gdata/common-elements.html">http://code.google.com/apis/gdata/common-elements.html</a></tt></dd></dl> |
| 343 | |
| 344 | <hr> |
| 345 | Class methods inherited from <a href="google.appengine.ext.db.html#Model">google.appengine.ext.db.Model</a>:<br> |
| 346 | <dl><dt><a name="CredentialsModel-all"><strong>all</strong></a>(cls, **kwds)<font color="#909090"><font face="helvetica, arial"> from <a href="google.appengine.ext.db.html#PropertiedClass">google.appengine.ext.db.PropertiedClass</a></font></font></dt><dd><tt>Returns a query over all instances of this model from the datastore.<br> |
| 347 | <br> |
| 348 | Returns:<br> |
| 349 | Query that will retrieve all instances from entity collection.</tt></dd></dl> |
| 350 | |
| 351 | <dl><dt><a name="CredentialsModel-entity_type"><strong>entity_type</strong></a>(cls)<font color="#909090"><font face="helvetica, arial"> from <a href="google.appengine.ext.db.html#PropertiedClass">google.appengine.ext.db.PropertiedClass</a></font></font></dt><dd><tt>Soon to be removed alias for kind.</tt></dd></dl> |
| 352 | |
| 353 | <dl><dt><a name="CredentialsModel-fields"><strong>fields</strong></a>(cls)<font color="#909090"><font face="helvetica, arial"> from <a href="google.appengine.ext.db.html#PropertiedClass">google.appengine.ext.db.PropertiedClass</a></font></font></dt><dd><tt>Soon to be removed alias for properties.</tt></dd></dl> |
| 354 | |
| 355 | <dl><dt><a name="CredentialsModel-from_entity"><strong>from_entity</strong></a>(cls, entity)<font color="#909090"><font face="helvetica, arial"> from <a href="google.appengine.ext.db.html#PropertiedClass">google.appengine.ext.db.PropertiedClass</a></font></font></dt><dd><tt>Converts the entity representation of this model to an instance.<br> |
| 356 | <br> |
| 357 | Converts datastore.Entity instance to an instance of cls.<br> |
| 358 | <br> |
| 359 | Args:<br> |
| 360 | entity: Entity loaded directly from datastore.<br> |
| 361 | <br> |
| 362 | Raises:<br> |
| 363 | KindError when cls is incorrect model for entity.</tt></dd></dl> |
| 364 | |
| 365 | <dl><dt><a name="CredentialsModel-get"><strong>get</strong></a>(cls, keys, **kwargs)<font color="#909090"><font face="helvetica, arial"> from <a href="google.appengine.ext.db.html#PropertiedClass">google.appengine.ext.db.PropertiedClass</a></font></font></dt><dd><tt>Fetch instance from the datastore of a specific <a href="google.appengine.ext.db.html#Model">Model</a> type using key.<br> |
| 366 | <br> |
| 367 | We support Key objects and string keys (we convert them to Key objects<br> |
| 368 | automatically).<br> |
| 369 | <br> |
| 370 | Useful for ensuring that specific instance types are retrieved from the<br> |
| 371 | datastore. It also helps that the source code clearly indicates what<br> |
| 372 | kind of <a href="__builtin__.html#object">object</a> is being retreived. Example:<br> |
| 373 | <br> |
| 374 | story = Story.<a href="#CredentialsModel-get">get</a>(story_key)<br> |
| 375 | <br> |
| 376 | Args:<br> |
| 377 | keys: Key within datastore entity collection to find; or string key;<br> |
| 378 | or list of Keys or string keys.<br> |
| 379 | config: datastore_rpc.Configuration to use for this request.<br> |
| 380 | <br> |
| 381 | Returns:<br> |
| 382 | If a single key was given: a <a href="google.appengine.ext.db.html#Model">Model</a> instance associated with key<br> |
| 383 | for provided class if it exists in the datastore, otherwise<br> |
| 384 | None; if a list of keys was given: a list whose items are either<br> |
| 385 | a <a href="google.appengine.ext.db.html#Model">Model</a> instance or None.<br> |
| 386 | <br> |
| 387 | Raises:<br> |
| 388 | KindError if any of the retreived objects are not instances of the<br> |
| 389 | type associated with call to 'get'.</tt></dd></dl> |
| 390 | |
| 391 | <dl><dt><a name="CredentialsModel-get_by_id"><strong>get_by_id</strong></a>(cls, ids, parent<font color="#909090">=None</font>, **kwargs)<font color="#909090"><font face="helvetica, arial"> from <a href="google.appengine.ext.db.html#PropertiedClass">google.appengine.ext.db.PropertiedClass</a></font></font></dt><dd><tt>Get instance of <a href="google.appengine.ext.db.html#Model">Model</a> class by id.<br> |
| 392 | <br> |
| 393 | Args:<br> |
| 394 | key_names: A single id or a list of ids.<br> |
| 395 | parent: Parent of instances to get. Can be a model or key.<br> |
| 396 | config: datastore_rpc.Configuration to use for this request.</tt></dd></dl> |
| 397 | |
| 398 | <dl><dt><a name="CredentialsModel-get_by_key_name"><strong>get_by_key_name</strong></a>(cls, key_names, parent<font color="#909090">=None</font>, **kwargs)<font color="#909090"><font face="helvetica, arial"> from <a href="google.appengine.ext.db.html#PropertiedClass">google.appengine.ext.db.PropertiedClass</a></font></font></dt><dd><tt>Get instance of <a href="google.appengine.ext.db.html#Model">Model</a> class by its key's name.<br> |
| 399 | <br> |
| 400 | Args:<br> |
| 401 | key_names: A single key-name or a list of key-names.<br> |
| 402 | parent: Parent of instances to get. Can be a model or key.<br> |
| 403 | config: datastore_rpc.Configuration to use for this request.</tt></dd></dl> |
| 404 | |
| 405 | <dl><dt><a name="CredentialsModel-get_or_insert"><strong>get_or_insert</strong></a>(cls, key_name, **kwds)<font color="#909090"><font face="helvetica, arial"> from <a href="google.appengine.ext.db.html#PropertiedClass">google.appengine.ext.db.PropertiedClass</a></font></font></dt><dd><tt>Transactionally retrieve or create an instance of <a href="google.appengine.ext.db.html#Model">Model</a> class.<br> |
| 406 | <br> |
| 407 | This acts much like the Python dictionary setdefault() method, where we<br> |
| 408 | first try to retrieve a <a href="google.appengine.ext.db.html#Model">Model</a> instance with the given key name and parent.<br> |
| 409 | If it's not present, then we create a new instance (using the *kwds<br> |
| 410 | supplied) and insert that with the supplied key name.<br> |
| 411 | <br> |
| 412 | Subsequent calls to this method with the same key_name and parent will<br> |
| 413 | always yield the same entity (though not the same actual <a href="__builtin__.html#object">object</a> instance),<br> |
| 414 | regardless of the *kwds supplied. If the specified entity has somehow<br> |
| 415 | been deleted separately, then the next call will create a new entity and<br> |
| 416 | return it.<br> |
| 417 | <br> |
| 418 | If the 'parent' keyword argument is supplied, it must be a <a href="google.appengine.ext.db.html#Model">Model</a> instance.<br> |
| 419 | It will be used as the parent of the new instance of this <a href="google.appengine.ext.db.html#Model">Model</a> class if<br> |
| 420 | one is created.<br> |
| 421 | <br> |
| 422 | This method is especially useful for having just one unique entity for<br> |
| 423 | a specific identifier. Insertion/retrieval is done transactionally, which<br> |
| 424 | guarantees uniqueness.<br> |
| 425 | <br> |
| 426 | Example usage:<br> |
| 427 | <br> |
| 428 | class WikiTopic(db.<a href="google.appengine.ext.db.html#Model">Model</a>):<br> |
| 429 | creation_date = db.DatetimeProperty(auto_now_add=True)<br> |
| 430 | body = db.TextProperty(required=True)<br> |
| 431 | <br> |
| 432 | # The first time through we'll create the new topic.<br> |
| 433 | wiki_word = 'CommonIdioms'<br> |
| 434 | topic = WikiTopic.<a href="#CredentialsModel-get_or_insert">get_or_insert</a>(wiki_word,<br> |
| 435 | body='This topic is totally new!')<br> |
| 436 | assert topic.<a href="#CredentialsModel-key">key</a>().name() == 'CommonIdioms'<br> |
| 437 | assert topic.body == 'This topic is totally new!'<br> |
| 438 | <br> |
| 439 | # The second time through will just retrieve the entity.<br> |
| 440 | overwrite_topic = WikiTopic.<a href="#CredentialsModel-get_or_insert">get_or_insert</a>(wiki_word,<br> |
| 441 | body='A totally different message!')<br> |
| 442 | assert topic.<a href="#CredentialsModel-key">key</a>().name() == 'CommonIdioms'<br> |
| 443 | assert topic.body == 'This topic is totally new!'<br> |
| 444 | <br> |
| 445 | Args:<br> |
| 446 | key_name: Key name to retrieve or create.<br> |
| 447 | **kwds: Keyword arguments to pass to the constructor of the model class<br> |
| 448 | if an instance for the specified key name does not already exist. If<br> |
| 449 | an instance with the supplied key_name and parent already exists, the<br> |
| 450 | rest of these arguments will be discarded.<br> |
| 451 | <br> |
| 452 | Returns:<br> |
| 453 | Existing instance of <a href="google.appengine.ext.db.html#Model">Model</a> class with the specified key_name and parent<br> |
| 454 | or a new one that has just been created.<br> |
| 455 | <br> |
| 456 | Raises:<br> |
| 457 | TransactionFailedError if the specified <a href="google.appengine.ext.db.html#Model">Model</a> instance could not be<br> |
| 458 | retrieved or created transactionally (due to high contention, etc).</tt></dd></dl> |
| 459 | |
| 460 | <dl><dt><a name="CredentialsModel-gql"><strong>gql</strong></a>(cls, query_string, *args, **kwds)<font color="#909090"><font face="helvetica, arial"> from <a href="google.appengine.ext.db.html#PropertiedClass">google.appengine.ext.db.PropertiedClass</a></font></font></dt><dd><tt>Returns a query using GQL query string.<br> |
| 461 | <br> |
| 462 | See appengine/ext/gql for more information about GQL.<br> |
| 463 | <br> |
| 464 | Args:<br> |
| 465 | query_string: properly formatted GQL query string with the<br> |
| 466 | 'SELECT * FROM <entity>' part omitted<br> |
| 467 | *args: rest of the positional arguments used to bind numeric references<br> |
| 468 | in the query.<br> |
| 469 | **kwds: dictionary-based arguments (for named parameters).</tt></dd></dl> |
| 470 | |
| 471 | <dl><dt><a name="CredentialsModel-kind"><strong>kind</strong></a>(cls)<font color="#909090"><font face="helvetica, arial"> from <a href="google.appengine.ext.db.html#PropertiedClass">google.appengine.ext.db.PropertiedClass</a></font></font></dt><dd><tt>Returns the datastore kind we use for this model.<br> |
| 472 | <br> |
| 473 | We just use the name of the model for now, ignoring potential collisions.</tt></dd></dl> |
| 474 | |
| 475 | <dl><dt><a name="CredentialsModel-properties"><strong>properties</strong></a>(cls)<font color="#909090"><font face="helvetica, arial"> from <a href="google.appengine.ext.db.html#PropertiedClass">google.appengine.ext.db.PropertiedClass</a></font></font></dt><dd><tt>Returns a dictionary of all the properties defined for this model.</tt></dd></dl> |
| 476 | |
| 477 | <hr> |
| 478 | Static methods inherited from <a href="google.appengine.ext.db.html#Model">google.appengine.ext.db.Model</a>:<br> |
| 479 | <dl><dt><a name="CredentialsModel-__new__"><strong>__new__</strong></a>(*args, **unused_kwds)</dt><dd><tt>Allow subclasses to call <a href="#CredentialsModel-__new__">__new__</a>() with arguments.<br> |
| 480 | <br> |
| 481 | Do NOT list 'cls' as the first argument, or in the case when<br> |
| 482 | the 'unused_kwds' dictionary contains the key 'cls', the function<br> |
| 483 | will complain about multiple argument values for 'cls'.<br> |
| 484 | <br> |
| 485 | Raises:<br> |
| 486 | TypeError if there are no positional arguments.</tt></dd></dl> |
| 487 | |
| 488 | <hr> |
| 489 | Data descriptors inherited from <a href="google.appengine.ext.db.html#Model">google.appengine.ext.db.Model</a>:<br> |
| 490 | <dl><dt><strong>__dict__</strong></dt> |
| 491 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 492 | </dl> |
| 493 | <dl><dt><strong>__weakref__</strong></dt> |
| 494 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 495 | </dl> |
| 496 | <hr> |
| 497 | Data and other attributes inherited from <a href="google.appengine.ext.db.html#Model">google.appengine.ext.db.Model</a>:<br> |
| 498 | <dl><dt><strong>__metaclass__</strong> = <class 'google.appengine.ext.db.PropertiedClass'><dd><tt>Meta-class for initializing <a href="google.appengine.ext.db.html#Model">Model</a> classes properties.<br> |
| 499 | <br> |
| 500 | Used for initializing Properties defined in the context of a model.<br> |
| 501 | By using a meta-class much of the configuration of a <a href="google.appengine.ext.db.html#Property">Property</a><br> |
| 502 | descriptor becomes implicit. By using this meta-class, descriptors<br> |
| 503 | that are of class <a href="google.appengine.ext.db.html#Model">Model</a> are notified about which class they<br> |
| 504 | belong to and what attribute they are associated with and can<br> |
| 505 | do appropriate initialization via __property_config__.<br> |
| 506 | <br> |
| 507 | Duplicate properties are not permitted.</tt></dl> |
| 508 | |
| 509 | </td></tr></table> <p> |
| 510 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 511 | <tr bgcolor="#ffc8d8"> |
| 512 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 513 | <font color="#000000" face="helvetica, arial"><a name="CredentialsProperty">class <strong>CredentialsProperty</strong></a>(<a href="google.appengine.ext.db.html#Property">google.appengine.ext.db.Property</a>)</font></td></tr> |
| 514 | |
| 515 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 516 | <td colspan=2><tt>App Engine datastore <a href="google.appengine.ext.db.html#Property">Property</a> for Credentials.<br> |
| 517 | <br> |
| 518 | Utility property that allows easy storage and retrieval of<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 519 | oath2client.Credentials<br> </tt></td></tr> |
| 520 | <tr><td> </td> |
| 521 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 522 | <dd><a href="oauth2client.appengine.html#CredentialsProperty">CredentialsProperty</a></dd> |
| 523 | <dd><a href="google.appengine.ext.db.html#Property">google.appengine.ext.db.Property</a></dd> |
| 524 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 525 | </dl> |
| 526 | <hr> |
| 527 | Methods defined here:<br> |
| 528 | <dl><dt><a name="CredentialsProperty-empty"><strong>empty</strong></a>(self, value)</dt></dl> |
| 529 | |
| 530 | <dl><dt><a name="CredentialsProperty-get_value_for_datastore"><strong>get_value_for_datastore</strong></a>(self, model_instance)</dt><dd><tt># For writing to datastore.</tt></dd></dl> |
| 531 | |
| 532 | <dl><dt><a name="CredentialsProperty-make_value_from_datastore"><strong>make_value_from_datastore</strong></a>(self, value)</dt><dd><tt># For reading from datastore.</tt></dd></dl> |
| 533 | |
| 534 | <dl><dt><a name="CredentialsProperty-validate"><strong>validate</strong></a>(self, value)</dt></dl> |
| 535 | |
| 536 | <hr> |
| 537 | Data and other attributes defined here:<br> |
| 538 | <dl><dt><strong>data_type</strong> = <class 'oauth2client.client.Credentials'><dd><tt>Base class for all Credentials objects.<br> |
| 539 | <br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame^] | 540 | Subclasses must define an authorize() method that applies the credentials to<br> |
| 541 | an HTTP transport.<br> |
| 542 | <br> |
| 543 | Subclasses must also specify a classmethod named 'from_json' that takes a JSON<br> |
| 544 | string as input and returns an instaniated Crentials <a href="__builtin__.html#object">object</a>.</tt></dl> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 545 | |
| 546 | <hr> |
| 547 | Methods inherited from <a href="google.appengine.ext.db.html#Property">google.appengine.ext.db.Property</a>:<br> |
| 548 | <dl><dt><a name="CredentialsProperty-__get__"><strong>__get__</strong></a>(self, model_instance, model_class)</dt><dd><tt>Returns the value for this property on the given model instance.<br> |
| 549 | <br> |
| 550 | See <a href="http://docs.python.org/ref/descriptors.html">http://docs.python.org/ref/descriptors.html</a> for a description of<br> |
| 551 | the arguments to this class and what they mean.</tt></dd></dl> |
| 552 | |
| 553 | <dl><dt><a name="CredentialsProperty-__init__"><strong>__init__</strong></a>(self, verbose_name<font color="#909090">=None</font>, name<font color="#909090">=None</font>, default<font color="#909090">=None</font>, required<font color="#909090">=False</font>, validator<font color="#909090">=None</font>, choices<font color="#909090">=None</font>, indexed<font color="#909090">=True</font>)</dt><dd><tt>Initializes this <a href="google.appengine.ext.db.html#Property">Property</a> with the given options.<br> |
| 554 | <br> |
| 555 | Args:<br> |
| 556 | verbose_name: User friendly name of property.<br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 557 | name: <a href="oauth2client.client.html#Storage">Storage</a> name for property. By default, uses attribute name<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 558 | as it is assigned in the <a href="google.appengine.ext.db.html#Model">Model</a> sub-class.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 559 | default: Default value for property if none is assigned.<br> |
| 560 | required: Whether property is required.<br> |
| 561 | validator: User provided method used for validation.<br> |
| 562 | choices: User provided set of valid property values.<br> |
| 563 | indexed: Whether property is indexed.</tt></dd></dl> |
| 564 | |
| 565 | <dl><dt><a name="CredentialsProperty-__property_config__"><strong>__property_config__</strong></a>(self, model_class, property_name)</dt><dd><tt>Configure property, connecting it to its model.<br> |
| 566 | <br> |
| 567 | Configure the property so that it knows its property name and what class<br> |
| 568 | it belongs to.<br> |
| 569 | <br> |
| 570 | Args:<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 571 | model_class: <a href="google.appengine.ext.db.html#Model">Model</a> class which <a href="google.appengine.ext.db.html#Property">Property</a> will belong to.<br> |
| 572 | property_name: Name of property within <a href="google.appengine.ext.db.html#Model">Model</a> instance to store property<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 573 | values in. By default this will be the property name preceded by<br> |
| 574 | an underscore, but may change for different subclasses.</tt></dd></dl> |
| 575 | |
| 576 | <dl><dt><a name="CredentialsProperty-__set__"><strong>__set__</strong></a>(self, model_instance, value)</dt><dd><tt>Sets the value for this property on the given model instance.<br> |
| 577 | <br> |
| 578 | See <a href="http://docs.python.org/ref/descriptors.html">http://docs.python.org/ref/descriptors.html</a> for a description of<br> |
| 579 | the arguments to this class and what they mean.</tt></dd></dl> |
| 580 | |
| 581 | <dl><dt><a name="CredentialsProperty-datastore_type"><strong>datastore_type</strong></a>(self)</dt><dd><tt>Deprecated backwards-compatible accessor method for self.<strong>data_type</strong>.</tt></dd></dl> |
| 582 | |
| 583 | <dl><dt><a name="CredentialsProperty-default_value"><strong>default_value</strong></a>(self)</dt><dd><tt>Default value for unassigned values.<br> |
| 584 | <br> |
| 585 | Returns:<br> |
| 586 | Default value as provided by <a href="#CredentialsProperty-__init__">__init__</a>(default).</tt></dd></dl> |
| 587 | |
| 588 | <hr> |
| 589 | Data descriptors inherited from <a href="google.appengine.ext.db.html#Property">google.appengine.ext.db.Property</a>:<br> |
| 590 | <dl><dt><strong>__dict__</strong></dt> |
| 591 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 592 | </dl> |
| 593 | <dl><dt><strong>__weakref__</strong></dt> |
| 594 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 595 | </dl> |
| 596 | <hr> |
| 597 | Data and other attributes inherited from <a href="google.appengine.ext.db.html#Property">google.appengine.ext.db.Property</a>:<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 598 | <dl><dt><strong>creation_counter</strong> = 1</dl> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 599 | |
| 600 | </td></tr></table> <p> |
| 601 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 602 | <tr bgcolor="#ffc8d8"> |
| 603 | <td colspan=3 valign=bottom> <br> |
| 604 | <font color="#000000" face="helvetica, arial"><a name="FlowProperty">class <strong>FlowProperty</strong></a>(<a href="google.appengine.ext.db.html#Property">google.appengine.ext.db.Property</a>)</font></td></tr> |
| 605 | |
| 606 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 607 | <td colspan=2><tt>App Engine datastore <a href="google.appengine.ext.db.html#Property">Property</a> for Flow.<br> |
| 608 | <br> |
| 609 | Utility property that allows easy storage and retreival of an<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 610 | oauth2client.Flow<br> </tt></td></tr> |
| 611 | <tr><td> </td> |
| 612 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 613 | <dd><a href="oauth2client.appengine.html#FlowProperty">FlowProperty</a></dd> |
| 614 | <dd><a href="google.appengine.ext.db.html#Property">google.appengine.ext.db.Property</a></dd> |
| 615 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 616 | </dl> |
| 617 | <hr> |
| 618 | Methods defined here:<br> |
| 619 | <dl><dt><a name="FlowProperty-empty"><strong>empty</strong></a>(self, value)</dt></dl> |
| 620 | |
| 621 | <dl><dt><a name="FlowProperty-get_value_for_datastore"><strong>get_value_for_datastore</strong></a>(self, model_instance)</dt><dd><tt># For writing to datastore.</tt></dd></dl> |
| 622 | |
| 623 | <dl><dt><a name="FlowProperty-make_value_from_datastore"><strong>make_value_from_datastore</strong></a>(self, value)</dt><dd><tt># For reading from datastore.</tt></dd></dl> |
| 624 | |
| 625 | <dl><dt><a name="FlowProperty-validate"><strong>validate</strong></a>(self, value)</dt></dl> |
| 626 | |
| 627 | <hr> |
| 628 | Data and other attributes defined here:<br> |
| 629 | <dl><dt><strong>data_type</strong> = <class 'oauth2client.client.Flow'><dd><tt>Base class for all Flow objects.</tt></dl> |
| 630 | |
| 631 | <hr> |
| 632 | Methods inherited from <a href="google.appengine.ext.db.html#Property">google.appengine.ext.db.Property</a>:<br> |
| 633 | <dl><dt><a name="FlowProperty-__get__"><strong>__get__</strong></a>(self, model_instance, model_class)</dt><dd><tt>Returns the value for this property on the given model instance.<br> |
| 634 | <br> |
| 635 | See <a href="http://docs.python.org/ref/descriptors.html">http://docs.python.org/ref/descriptors.html</a> for a description of<br> |
| 636 | the arguments to this class and what they mean.</tt></dd></dl> |
| 637 | |
| 638 | <dl><dt><a name="FlowProperty-__init__"><strong>__init__</strong></a>(self, verbose_name<font color="#909090">=None</font>, name<font color="#909090">=None</font>, default<font color="#909090">=None</font>, required<font color="#909090">=False</font>, validator<font color="#909090">=None</font>, choices<font color="#909090">=None</font>, indexed<font color="#909090">=True</font>)</dt><dd><tt>Initializes this <a href="google.appengine.ext.db.html#Property">Property</a> with the given options.<br> |
| 639 | <br> |
| 640 | Args:<br> |
| 641 | verbose_name: User friendly name of property.<br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 642 | name: <a href="oauth2client.client.html#Storage">Storage</a> name for property. By default, uses attribute name<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 643 | as it is assigned in the <a href="google.appengine.ext.db.html#Model">Model</a> sub-class.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 644 | default: Default value for property if none is assigned.<br> |
| 645 | required: Whether property is required.<br> |
| 646 | validator: User provided method used for validation.<br> |
| 647 | choices: User provided set of valid property values.<br> |
| 648 | indexed: Whether property is indexed.</tt></dd></dl> |
| 649 | |
| 650 | <dl><dt><a name="FlowProperty-__property_config__"><strong>__property_config__</strong></a>(self, model_class, property_name)</dt><dd><tt>Configure property, connecting it to its model.<br> |
| 651 | <br> |
| 652 | Configure the property so that it knows its property name and what class<br> |
| 653 | it belongs to.<br> |
| 654 | <br> |
| 655 | Args:<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 656 | model_class: <a href="google.appengine.ext.db.html#Model">Model</a> class which <a href="google.appengine.ext.db.html#Property">Property</a> will belong to.<br> |
| 657 | property_name: Name of property within <a href="google.appengine.ext.db.html#Model">Model</a> instance to store property<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 658 | values in. By default this will be the property name preceded by<br> |
| 659 | an underscore, but may change for different subclasses.</tt></dd></dl> |
| 660 | |
| 661 | <dl><dt><a name="FlowProperty-__set__"><strong>__set__</strong></a>(self, model_instance, value)</dt><dd><tt>Sets the value for this property on the given model instance.<br> |
| 662 | <br> |
| 663 | See <a href="http://docs.python.org/ref/descriptors.html">http://docs.python.org/ref/descriptors.html</a> for a description of<br> |
| 664 | the arguments to this class and what they mean.</tt></dd></dl> |
| 665 | |
| 666 | <dl><dt><a name="FlowProperty-datastore_type"><strong>datastore_type</strong></a>(self)</dt><dd><tt>Deprecated backwards-compatible accessor method for self.<strong>data_type</strong>.</tt></dd></dl> |
| 667 | |
| 668 | <dl><dt><a name="FlowProperty-default_value"><strong>default_value</strong></a>(self)</dt><dd><tt>Default value for unassigned values.<br> |
| 669 | <br> |
| 670 | Returns:<br> |
| 671 | Default value as provided by <a href="#FlowProperty-__init__">__init__</a>(default).</tt></dd></dl> |
| 672 | |
| 673 | <hr> |
| 674 | Data descriptors inherited from <a href="google.appengine.ext.db.html#Property">google.appengine.ext.db.Property</a>:<br> |
| 675 | <dl><dt><strong>__dict__</strong></dt> |
| 676 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 677 | </dl> |
| 678 | <dl><dt><strong>__weakref__</strong></dt> |
| 679 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 680 | </dl> |
| 681 | <hr> |
| 682 | Data and other attributes inherited from <a href="google.appengine.ext.db.html#Property">google.appengine.ext.db.Property</a>:<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 683 | <dl><dt><strong>creation_counter</strong> = 1</dl> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 684 | |
| 685 | </td></tr></table> <p> |
| 686 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 687 | <tr bgcolor="#ffc8d8"> |
| 688 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 689 | <font color="#000000" face="helvetica, arial"><a name="OAuth2Decorator">class <strong>OAuth2Decorator</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr> |
| 690 | |
| 691 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 692 | <td colspan=2><tt>Utility for making OAuth 2.0 easier.<br> |
| 693 | <br> |
| 694 | Instantiate and then use with oauth_required or oauth_aware<br> |
| 695 | as decorators on webapp.<a href="google.appengine.ext.webapp.html#RequestHandler">RequestHandler</a> methods.<br> |
| 696 | <br> |
| 697 | Example:<br> |
| 698 | <br> |
| 699 | decorator = <a href="#OAuth2Decorator">OAuth2Decorator</a>(<br> |
| 700 | client_id='837...ent.com',<br> |
| 701 | client_secret='Qh...wwI',<br> |
Joe Gregorio | 0250385 | 2011-08-31 09:07:55 -0400 | [diff] [blame] | 702 | scope='https://www.googleapis.com/auth/buzz')<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 703 | <br> |
| 704 | <br> |
| 705 | class MainHandler(webapp.<a href="google.appengine.ext.webapp.html#RequestHandler">RequestHandler</a>):<br> |
| 706 | <br> |
| 707 | @decorator.oauth_required<br> |
| 708 | def get(self):<br> |
| 709 | http = decorator.<a href="#OAuth2Decorator-http">http</a>()<br> |
| 710 | # http is authorized with the user's Credentials and can be used<br> |
| 711 | # in API calls<br> </tt></td></tr> |
| 712 | <tr><td> </td> |
| 713 | <td width="100%">Methods defined here:<br> |
Joe Gregorio | 0250385 | 2011-08-31 09:07:55 -0400 | [diff] [blame] | 714 | <dl><dt><a name="OAuth2Decorator-__init__"><strong>__init__</strong></a>(self, client_id, client_secret, scope, auth_uri<font color="#909090">='https://accounts.google.com/o/oauth2/auth'</font>, token_uri<font color="#909090">='https://accounts.google.com/o/oauth2/token'</font>)</dt><dd><tt>Constructor for <a href="#OAuth2Decorator">OAuth2Decorator</a><br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 715 | <br> |
| 716 | Args:<br> |
| 717 | client_id: string, client identifier.<br> |
| 718 | client_secret: string client secret.<br> |
| 719 | scope: string, scope of the credentials being requested.<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 720 | auth_uri: string, URI for authorization endpoint. For convenience<br> |
| 721 | defaults to Google's endpoints but any OAuth 2.0 provider can be used.<br> |
| 722 | token_uri: string, URI for token endpoint. For convenience<br> |
| 723 | defaults to Google's endpoints but any OAuth 2.0 provider can be used.</tt></dd></dl> |
| 724 | |
| 725 | <dl><dt><a name="OAuth2Decorator-authorize_url"><strong>authorize_url</strong></a>(self)</dt><dd><tt>Returns the URL to start the OAuth dance.<br> |
| 726 | <br> |
| 727 | Must only be called from with a webapp.<a href="google.appengine.ext.webapp.html#RequestHandler">RequestHandler</a> subclassed method<br> |
| 728 | that had been decorated with either @oauth_required or @oauth_aware.</tt></dd></dl> |
| 729 | |
| 730 | <dl><dt><a name="OAuth2Decorator-has_credentials"><strong>has_credentials</strong></a>(self)</dt><dd><tt>True if for the logged in user there are valid access Credentials.<br> |
| 731 | <br> |
| 732 | Must only be called from with a webapp.<a href="google.appengine.ext.webapp.html#RequestHandler">RequestHandler</a> subclassed method<br> |
| 733 | that had been decorated with either @oauth_required or @oauth_aware.</tt></dd></dl> |
| 734 | |
| 735 | <dl><dt><a name="OAuth2Decorator-http"><strong>http</strong></a>(self)</dt><dd><tt>Returns an authorized http instance.<br> |
| 736 | <br> |
| 737 | Must only be called from within an @oauth_required decorated method, or<br> |
| 738 | from within an @oauth_aware decorated method where <a href="#OAuth2Decorator-has_credentials">has_credentials</a>()<br> |
| 739 | returns True.</tt></dd></dl> |
| 740 | |
| 741 | <dl><dt><a name="OAuth2Decorator-oauth_aware"><strong>oauth_aware</strong></a>(self, method)</dt><dd><tt>Decorator that sets up for OAuth 2.0 dance, but doesn't do it.<br> |
| 742 | <br> |
| 743 | Does all the setup for the OAuth dance, but doesn't initiate it.<br> |
| 744 | This decorator is useful if you want to create a page that knows<br> |
| 745 | whether or not the user has granted access to this application.<br> |
| 746 | From within a method decorated with @oauth_aware the <a href="#OAuth2Decorator-has_credentials">has_credentials</a>()<br> |
| 747 | and <a href="#OAuth2Decorator-authorize_url">authorize_url</a>() methods can be called.<br> |
| 748 | <br> |
| 749 | Args:<br> |
| 750 | method: callable, to be decorated method of a webapp.<a href="google.appengine.ext.webapp.html#RequestHandler">RequestHandler</a><br> |
| 751 | instance.</tt></dd></dl> |
| 752 | |
| 753 | <dl><dt><a name="OAuth2Decorator-oauth_required"><strong>oauth_required</strong></a>(self, method)</dt><dd><tt>Decorator that starts the OAuth 2.0 dance.<br> |
| 754 | <br> |
| 755 | Starts the OAuth dance for the logged in user if they haven't already<br> |
| 756 | granted access for this application.<br> |
| 757 | <br> |
| 758 | Args:<br> |
| 759 | method: callable, to be decorated method of a webapp.<a href="google.appengine.ext.webapp.html#RequestHandler">RequestHandler</a><br> |
| 760 | instance.</tt></dd></dl> |
| 761 | |
| 762 | <hr> |
| 763 | Data descriptors defined here:<br> |
| 764 | <dl><dt><strong>__dict__</strong></dt> |
| 765 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 766 | </dl> |
| 767 | <dl><dt><strong>__weakref__</strong></dt> |
| 768 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 769 | </dl> |
| 770 | </td></tr></table> <p> |
| 771 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 772 | <tr bgcolor="#ffc8d8"> |
| 773 | <td colspan=3 valign=bottom> <br> |
| 774 | <font color="#000000" face="helvetica, arial"><a name="OAuth2Handler">class <strong>OAuth2Handler</strong></a>(<a href="google.appengine.ext.webapp.html#RequestHandler">google.appengine.ext.webapp.RequestHandler</a>)</font></td></tr> |
| 775 | |
| 776 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 777 | <td colspan=2><tt>Handler for the redirect_uri of the OAuth 2.0 dance.<br> </tt></td></tr> |
| 778 | <tr><td> </td> |
| 779 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 780 | <dd><a href="oauth2client.appengine.html#OAuth2Handler">OAuth2Handler</a></dd> |
| 781 | <dd><a href="google.appengine.ext.webapp.html#RequestHandler">google.appengine.ext.webapp.RequestHandler</a></dd> |
| 782 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 783 | </dl> |
| 784 | <hr> |
| 785 | Methods defined here:<br> |
| 786 | <dl><dt><a name="OAuth2Handler-get"><strong>get</strong></a> = check_login(self, *args)</dt></dl> |
| 787 | |
| 788 | <hr> |
| 789 | Methods inherited from <a href="google.appengine.ext.webapp.html#RequestHandler">google.appengine.ext.webapp.RequestHandler</a>:<br> |
| 790 | <dl><dt><a name="OAuth2Handler-delete"><strong>delete</strong></a>(self, *args)</dt><dd><tt>Handler method for DELETE requests.</tt></dd></dl> |
| 791 | |
| 792 | <dl><dt><a name="OAuth2Handler-error"><strong>error</strong></a>(self, code)</dt><dd><tt>Clears the response output stream and sets the given HTTP error code.<br> |
| 793 | <br> |
| 794 | Args:<br> |
| 795 | code: the HTTP status error code (e.g., 501)</tt></dd></dl> |
| 796 | |
| 797 | <dl><dt><a name="OAuth2Handler-handle_exception"><strong>handle_exception</strong></a>(self, exception, debug_mode)</dt><dd><tt>Called if this handler throws an exception during execution.<br> |
| 798 | <br> |
| 799 | The default behavior is to call <a href="#OAuth2Handler-error">error</a>(500) and print a stack trace<br> |
| 800 | if debug_mode is True.<br> |
| 801 | <br> |
| 802 | Args:<br> |
| 803 | exception: the exception that was thrown<br> |
| 804 | debug_mode: True if the web application is running in debug mode</tt></dd></dl> |
| 805 | |
| 806 | <dl><dt><a name="OAuth2Handler-head"><strong>head</strong></a>(self, *args)</dt><dd><tt>Handler method for HEAD requests.</tt></dd></dl> |
| 807 | |
| 808 | <dl><dt><a name="OAuth2Handler-initialize"><strong>initialize</strong></a>(self, request, response)</dt><dd><tt>Initializes this request handler with the given Request and Response.</tt></dd></dl> |
| 809 | |
| 810 | <dl><dt><a name="OAuth2Handler-options"><strong>options</strong></a>(self, *args)</dt><dd><tt>Handler method for OPTIONS requests.</tt></dd></dl> |
| 811 | |
| 812 | <dl><dt><a name="OAuth2Handler-post"><strong>post</strong></a>(self, *args)</dt><dd><tt>Handler method for POST requests.</tt></dd></dl> |
| 813 | |
| 814 | <dl><dt><a name="OAuth2Handler-put"><strong>put</strong></a>(self, *args)</dt><dd><tt>Handler method for PUT requests.</tt></dd></dl> |
| 815 | |
| 816 | <dl><dt><a name="OAuth2Handler-redirect"><strong>redirect</strong></a>(self, uri, permanent<font color="#909090">=False</font>)</dt><dd><tt>Issues an HTTP redirect to the given relative URL.<br> |
| 817 | <br> |
| 818 | Args:<br> |
| 819 | uri: a relative or absolute URI (e.g., '../flowers.html')<br> |
| 820 | permanent: if true, we use a 301 redirect instead of a 302 redirect</tt></dd></dl> |
| 821 | |
| 822 | <dl><dt><a name="OAuth2Handler-trace"><strong>trace</strong></a>(self, *args)</dt><dd><tt>Handler method for TRACE requests.</tt></dd></dl> |
| 823 | |
| 824 | <hr> |
| 825 | Class methods inherited from <a href="google.appengine.ext.webapp.html#RequestHandler">google.appengine.ext.webapp.RequestHandler</a>:<br> |
| 826 | <dl><dt><a name="OAuth2Handler-get_url"><strong>get_url</strong></a>(cls, *args, **kargs)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Returns the url for the given handler.<br> |
| 827 | <br> |
| 828 | The default implementation uses the patterns passed to the active<br> |
| 829 | WSGIApplication to create a url. However, it is different from Django's<br> |
| 830 | urlresolvers.reverse() in the following ways:<br> |
| 831 | - It does not try to resolve handlers via module loading<br> |
| 832 | - It does not support named arguments<br> |
| 833 | - It performs some post-prosessing on the url to remove some regex<br> |
| 834 | operators.<br> |
| 835 | - It will try to fill in the left-most missing arguments with the args<br> |
| 836 | used in the active request.<br> |
| 837 | <br> |
| 838 | Args:<br> |
| 839 | args: Parameters for the url pattern's groups.<br> |
| 840 | kwargs: Optionally contains 'implicit_args' that can either be a boolean<br> |
| 841 | or a tuple. When it is True, it will use the arguments to the<br> |
| 842 | active request as implicit arguments. When it is False (default),<br> |
| 843 | it will not use any implicit arguments. When it is a tuple, it<br> |
| 844 | will use the tuple as the implicit arguments.<br> |
| 845 | the left-most args if some are missing from args.<br> |
| 846 | <br> |
| 847 | Returns:<br> |
| 848 | The url for this handler/args combination.<br> |
| 849 | <br> |
| 850 | Raises:<br> |
| 851 | NoUrlFoundError: No url pattern for this handler has the same<br> |
| 852 | number of args that were passed in.</tt></dd></dl> |
| 853 | |
| 854 | <dl><dt><a name="OAuth2Handler-new_factory"><strong>new_factory</strong></a>(cls, *args, **kwargs)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Create new request handler factory.<br> |
| 855 | <br> |
| 856 | Use factory method to create reusable request handlers that just<br> |
| 857 | require a few configuration parameters to construct. Also useful<br> |
| 858 | for injecting shared state between multiple request handler<br> |
| 859 | instances without relying on global variables. For example, to<br> |
| 860 | create a set of post handlers that will do simple text transformations<br> |
| 861 | you can write:<br> |
| 862 | <br> |
| 863 | class ChangeTextHandler(webapp.<a href="google.appengine.ext.webapp.html#RequestHandler">RequestHandler</a>):<br> |
| 864 | <br> |
| 865 | def <a href="#OAuth2Handler-__init__">__init__</a>(self, transform):<br> |
| 866 | self.<strong>transform</strong> = transform<br> |
| 867 | <br> |
| 868 | def <a href="#OAuth2Handler-post">post</a>(self):<br> |
| 869 | response_text = transform(<br> |
| 870 | self.<strong>request</strong>.request.body_file.getvalue())<br> |
| 871 | self.<strong>response</strong>.out.write(response_text)<br> |
| 872 | <br> |
| 873 | application = webapp.WSGIApplication(<br> |
| 874 | [('/to_lower', ChangeTextHandler.<a href="#OAuth2Handler-new_factory">new_factory</a>(str.lower)),<br> |
| 875 | ('/to_upper', ChangeTextHandler.<a href="#OAuth2Handler-new_factory">new_factory</a>(str.upper)),<br> |
| 876 | ],<br> |
| 877 | debug=True)<br> |
| 878 | <br> |
| 879 | Text POSTed to /to_lower will be lower cased.<br> |
| 880 | Text POSTed to /to_upper will be upper cased.</tt></dd></dl> |
| 881 | |
| 882 | <hr> |
| 883 | Data descriptors inherited from <a href="google.appengine.ext.webapp.html#RequestHandler">google.appengine.ext.webapp.RequestHandler</a>:<br> |
| 884 | <dl><dt><strong>__dict__</strong></dt> |
| 885 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 886 | </dl> |
| 887 | <dl><dt><strong>__weakref__</strong></dt> |
| 888 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 889 | </dl> |
| 890 | </td></tr></table> <p> |
| 891 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 892 | <tr bgcolor="#ffc8d8"> |
| 893 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 894 | <font color="#000000" face="helvetica, arial"><a name="StorageByKeyName">class <strong>StorageByKeyName</strong></a>(<a href="oauth2client.client.html#Storage">oauth2client.client.Storage</a>)</font></td></tr> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 895 | |
| 896 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 897 | <td colspan=2><tt>Store and retrieve a single credential to and from<br> |
| 898 | the App Engine datastore.<br> |
| 899 | <br> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 900 | This <a href="oauth2client.client.html#Storage">Storage</a> helper presumes the Credentials<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 901 | have been stored as a CredenialsProperty<br> |
| 902 | on a datastore model class, and that entities<br> |
| 903 | are stored by key_name.<br> </tt></td></tr> |
| 904 | <tr><td> </td> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 905 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 906 | <dd><a href="oauth2client.appengine.html#StorageByKeyName">StorageByKeyName</a></dd> |
| 907 | <dd><a href="oauth2client.client.html#Storage">oauth2client.client.Storage</a></dd> |
| 908 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 909 | </dl> |
| 910 | <hr> |
| 911 | Methods defined here:<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 912 | <dl><dt><a name="StorageByKeyName-__init__"><strong>__init__</strong></a>(self, model, key_name, property_name, cache<font color="#909090">=None</font>)</dt><dd><tt>Constructor for <a href="oauth2client.client.html#Storage">Storage</a>.<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 913 | <br> |
| 914 | Args:<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 915 | model: db.<a href="google.appengine.ext.db.html#Model">Model</a>, model class<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 916 | key_name: string, key name for the entity that has the credentials<br> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 917 | property_name: string, name of the property that is a <a href="#CredentialsProperty">CredentialsProperty</a><br> |
| 918 | cache: memcache, a write-through cache to put in front of the datastore</tt></dd></dl> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 919 | |
| 920 | <dl><dt><a name="StorageByKeyName-get"><strong>get</strong></a>(self)</dt><dd><tt>Retrieve Credential from datastore.<br> |
| 921 | <br> |
| 922 | Returns:<br> |
| 923 | oauth2client.Credentials</tt></dd></dl> |
| 924 | |
| 925 | <dl><dt><a name="StorageByKeyName-put"><strong>put</strong></a>(self, credentials)</dt><dd><tt>Write a Credentials to the datastore.<br> |
| 926 | <br> |
| 927 | Args:<br> |
| 928 | credentials: Credentials, the credentials to store.</tt></dd></dl> |
| 929 | |
| 930 | <hr> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame^] | 931 | Methods inherited from <a href="oauth2client.client.html#Storage">oauth2client.client.Storage</a>:<br> |
| 932 | <dl><dt><a name="StorageByKeyName-acquire_lock"><strong>acquire_lock</strong></a>(self)</dt><dd><tt>Acquires any lock necessary to access this <a href="oauth2client.client.html#Storage">Storage</a>.<br> |
| 933 | <br> |
| 934 | This lock is not reentrant.</tt></dd></dl> |
| 935 | |
| 936 | <dl><dt><a name="StorageByKeyName-locked_get"><strong>locked_get</strong></a>(self)</dt><dd><tt>Retrieve credential.<br> |
| 937 | <br> |
| 938 | The <a href="oauth2client.client.html#Storage">Storage</a> lock must be held when this is called.<br> |
| 939 | <br> |
| 940 | Returns:<br> |
| 941 | oauth2client.client.Credentials</tt></dd></dl> |
| 942 | |
| 943 | <dl><dt><a name="StorageByKeyName-locked_put"><strong>locked_put</strong></a>(self, credentials)</dt><dd><tt>Write a credential.<br> |
| 944 | <br> |
| 945 | The <a href="oauth2client.client.html#Storage">Storage</a> lock must be held when this is called.<br> |
| 946 | <br> |
| 947 | Args:<br> |
| 948 | credentials: Credentials, the credentials to store.</tt></dd></dl> |
| 949 | |
| 950 | <dl><dt><a name="StorageByKeyName-release_lock"><strong>release_lock</strong></a>(self)</dt><dd><tt>Release the <a href="oauth2client.client.html#Storage">Storage</a> lock.<br> |
| 951 | <br> |
| 952 | Trying to release a lock that isn't held will result in a<br> |
| 953 | RuntimeError.</tt></dd></dl> |
| 954 | |
| 955 | <hr> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 956 | Data descriptors inherited from <a href="oauth2client.client.html#Storage">oauth2client.client.Storage</a>:<br> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 957 | <dl><dt><strong>__dict__</strong></dt> |
| 958 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 959 | </dl> |
| 960 | <dl><dt><strong>__weakref__</strong></dt> |
| 961 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 962 | </dl> |
| 963 | </td></tr></table></td></tr></table><p> |
| 964 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 965 | <tr bgcolor="#eeaa77"> |
| 966 | <td colspan=3 valign=bottom> <br> |
| 967 | <font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr> |
| 968 | |
| 969 | <tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td> |
| 970 | <td width="100%"><dl><dt><a name="-main"><strong>main</strong></a>()</dt></dl> |
| 971 | </td></tr></table><p> |
| 972 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 973 | <tr bgcolor="#55aa55"> |
| 974 | <td colspan=3 valign=bottom> <br> |
| 975 | <font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr> |
| 976 | |
| 977 | <tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td> |
Joe Gregorio | 90e7ec2 | 2011-07-06 10:09:20 -0400 | [diff] [blame] | 978 | <td width="100%"><strong>OAUTH2CLIENT_NAMESPACE</strong> = 'oauth2client#ns'<br> |
| 979 | <strong>__author__</strong> = 'jcgregorio@google.com (Joe Gregorio)'<br> |
| 980 | <strong>application</strong> = <google.appengine.ext.webapp.WSGIApplication object></td></tr></table><p> |
Joe Gregorio | 6e53703 | 2011-02-09 23:04:26 -0500 | [diff] [blame] | 981 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 982 | <tr bgcolor="#7799ee"> |
| 983 | <td colspan=3 valign=bottom> <br> |
| 984 | <font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr> |
| 985 | |
| 986 | <tr><td bgcolor="#7799ee"><tt> </tt></td><td> </td> |
| 987 | <td width="100%">jcgregorio@google.com (Joe Gregorio)</td></tr></table> |
| 988 | </body></html> |