PageRenderTime 406ms queryTime 87ms sortTime 31ms getByIdsTime 61ms findMatchingLines 27ms

100+ results results for 'ERROR repo:muyelian/deathofrace' (406 ms)

Not the results you expected?
ErrorData.html http://xformsdb.googlecode.com/svn/trunk/ | HTML | 342 lines
                    
96<P>
                    
97Contains information about an error, for error pages.
                    
98 The information contained in this instance is meaningless if not used
                    
98 The information contained in this instance is meaningless if not used
                    
99 in the context of an error page.  To indicate a JSP is an error page,
                    
100 the page author must set the isErrorPage attribute of the page directive
                    
107  <DD>2.0</DD>
                    
108<DT><B>See Also:</B><DD><A HREF="../../../javax/servlet/jsp/PageContext.html#getErrorData()"><CODE>PageContext.getErrorData()</CODE></A></DL>
                    
109<HR>
                    
126<TR BGCOLOR="white" CLASS="TableRowColor">
                    
127<TD><CODE><B><A HREF="../../../javax/servlet/jsp/ErrorData.html#ErrorData(java.lang.Throwable, int, java.lang.String, java.lang.String)">ErrorData</A></B>(java.lang.Throwable&nbsp;throwable,
                    
128          int&nbsp;statusCode,
                    
212<P>
                    
213<DT><B>Parameters:</B><DD><CODE>throwable</CODE> - The Throwable that is the cause of the error<DD><CODE>statusCode</CODE> - The status code of the error<DD><CODE>uri</CODE> - The request URI<DD><CODE>servletName</CODE> - The name of the servlet invoked</DL>
                    
214
                    
                
JavaAction.java https://svn.apache.org/repos/asf/incubator/isis/ | Java | 0 lines
                    
120        if (parameters.length != paramCount) {
                    
121            LOG.error(actionMethod + " requires " + paramCount + " parameters, not " + parameters.length);
                    
122        }
                    
175        if (parameterSet.length != paramCount) {
                    
176            LOG.error(actionMethod + " requires " + paramCount + " parameters, not " + parameterSet.length);
                    
177        }
                    
                
CompositeDependencyHandler.cs https://hg01.codeplex.com/clientdependency | C# | 0 lines
                    
98            //retry up to 5 times... this is only here due to a bug found in another website that was returning a blank 
                    
99            //result. To date, it can't be replicated in VS, but we'll leave it here for error handling support... can't hurt
                    
100            for (int i = 0; i < 5; i++)
                    
105
                    
106                ClientDependencySettings.Instance.Logger.Error(string.Format("No bytes were returned, this is attempt {0}. Fileset: {1}, Type: {2}, Version: {3}", i, fileset, type, version), null);
                    
107            }
                    
225            {
                    
226                ClientDependencySettings.Instance.Logger.Error("ClientDependency handler path is null", new Exception());
                    
227                return;
                    
                
dbmechanic.py http://dbsprockets.googlecode.com/svn/trunk/ | Python | 162 lines
                    
15from dbsprockets.sprockets import Sprockets
                    
16#from dbsprockets.decorators import crudErrorCatcher, validate
                    
17from tw.api import WidgetBunch
                    
138    # @validate(error_handler=editRecord)
                    
139    #@crudErrorCatcher(errorType=sqlalchemy.exceptions.IntegrityError, error_handler='editRecord')
                    
140    #@crudErrorCatcher(errorType=sqlalchemy.exceptions.ProgrammingError, error_handler='editRecord')
                    
148    # @validate(error_handler=addRecord)
                    
149    #@crudErrorCatcher(errorType=sqlalchemy.exceptions.IntegrityError, error_handler='addRecord')
                    
150    #@crudErrorCatcher(errorType=sqlalchemy.exceptions.ProgrammingError, error_handler='addRecord')
                    
                
MembershipRequestServiceHttp.java git://github.com/liferay/liferay-portal.git | Java | 229 lines
                    
89
                    
90			_log.error(systemException, systemException);
                    
91
                    
125
                    
126			_log.error(systemException, systemException);
                    
127
                    
166
                    
167			_log.error(systemException, systemException);
                    
168
                    
205
                    
206			_log.error(systemException, systemException);
                    
207
                    
                
TikaRawMetadataProcessor.java git://github.com/liferay/liferay-portal.git | Java | 255 lines
                    
230				else {
                    
231					_log.error(exception, exception);
                    
232				}
                    
                
BaseServiceRemote.java http://tauruss.googlecode.com/svn/trunk/ | Java | 265 lines
                    
99			} catch (Exception e) {
                    
100				log.error(e);
                    
101			}
                    
                
medici.erl git://github.com/evanmiller/ChicagoBoss.git | Erlang | 0 lines
                    
44
                    
45%% @spec start() -> {ok, Pid} | Error:term()
                    
46%%
                    
50
                    
51%% @spec start(StartupOptions::proplist()) -> {ok, Pid} | Error:term()
                    
52%%
                    
276    ?assert(?MODULE:get(<<"putkeep1">>) =:= <<"foo">>),
                    
277    ?assertMatch({error, _}, ?MODULE:putkeep(<<"putkeep1">>, <<"bar">>)),
                    
278    ?assert(?MODULE:get(<<"putkeep1">>) =:= <<"foo">>), % no effect if key already exists before putkeep
                    
301    ok = ?MODULE:out(<<"out1">>),
                    
302    ?assertMatch({error, _}, ?MODULE:get(<<"out1">>)).
                    
303
                    
322    ok = ?MODULE:vanish(),
                    
323    ?assertMatch({error, _}, ?MODULE:get(<<"vanish1">>)).
                    
324
                    
                
javaw.py https://code.google.com/p/waf/ | Python | 475 lines
                    
29import os, re, tempfile, shutil
                    
30from waflib import TaskGen, Task, Utils, Options, Build, Errors, Node, Logs
                    
31from waflib.Configure import conf
                    
229			except Exception:
                    
230				raise Errors.WafError('Could not find the basedir %r for %r' % (self.basedir, self))
                    
231		return super(jar_create, self).runnable_status()
                    
                
BuildLogger.html http://xformsdb.googlecode.com/svn/trunk/ | HTML | 312 lines
                    
128<CODE>&nbsp;void</CODE></FONT></TD>
                    
129<TD><CODE><B><A HREF="../../../../org/apache/tools/ant/BuildLogger.html#setErrorPrintStream(java.io.PrintStream)">setErrorPrintStream</A></B>(java.io.PrintStream&nbsp;err)</CODE>
                    
130
                    
131<BR>
                    
132&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the output stream to which this logger is to send error messages.</TD>
                    
133</TR>
                    
237
                    
238<A NAME="setErrorPrintStream(java.io.PrintStream)"><!-- --></A><H3>
                    
239setErrorPrintStream</H3>
                    
240<PRE>
                    
241public void <B>setErrorPrintStream</B>(java.io.PrintStream&nbsp;err)</PRE>
                    
242<DL>
                    
242<DL>
                    
243<DD>Sets the output stream to which this logger is to send error messages.
                    
244<P>
                    
                
SubversionResolver.cs https://sourceserversharp.svn.codeplex.com/svn | C# | 0 lines
                    
135			psi.RedirectStandardOutput = true;
                    
136			psi.RedirectStandardError = true;
                    
137			psi.RedirectStandardInput = true;
                    
155
                    
156				// Check if the volume exists; if not 'svn status' returns "svn: Error resolving case of 'q:\q'"
                    
157				string root = Path.GetPathRoot(file.Key);
                    
181					p.StandardInput.Close();
                    
182					p.ErrorDataReceived += new DataReceivedEventHandler(svnStatus_ErrorDataReceived);
                    
183					p.OutputDataReceived += new DataReceivedEventHandler(svnStatus_OutputDataReceived);
                    
184					_svnStatusOutput = new StringBuilder();
                    
185					_receivedError = false;
                    
186					p.BeginErrorReadLine();
                    
191					_svnStatusOutput = null;
                    
192					//string errs = p.StandardError.ReadToEnd();
                    
193
                    
                
__init__.py https://bitbucket.org/birkenfeld/sphinx/ | Python | 351 lines
                    
18from sphinx import package_dir
                    
19from sphinx.errors import PycodeError
                    
20from sphinx.pycode import nodes
                    
188        except Exception as err:
                    
189            raise PycodeError('error opening %r' % filename, err)
                    
190        obj = cls(fileobj, modname, filename)
                    
197            entry = cls.cache['module', modname]
                    
198            if isinstance(entry, PycodeError):
                    
199                raise entry
                    
207                obj = cls.for_file(source, modname)
                    
208        except PycodeError as err:
                    
209            cls.cache['module', modname] = err
                    
250            self.tokens = list(tokenize.generate_tokens(self.source.readline))
                    
251        except tokenize.TokenError as err:
                    
252            raise PycodeError('tokenizing failed', err)
                    
                
KhorosToMatLab.old git://github.com/aludnam/MATLAB.git | Perl | 452 lines
                    
278    print "elseif nargin ==2\n  Inputs=varargin{1}; arglist=varargin{2};\n";
                    
279    print "else error('Usage: [out1,..] = k$fname(Inputs,arglist).');\nend\n";
                    
280  }
                    
285    print "elseif nargin ==1\n  arglist=varargin{1};\n";
                    
286    print "else error('Usage: [out1,..] = k$fname(arglist).');\nend\n";
                    
287  }
                    
287  }
                    
288print "if size(arglist,2)~=2\n  error('arglist must be of form {''ParameterTag1'',value1;''ParameterTag2'',value2}')\n end\n";
                    
289
                    
342      if (nextinput > length(Inputs)) 
                    
343        error(['Input ' narglist{jj,1} ' has no corresponding input!']); 
                    
344      end
                    
348      if (nextoutput > nargout) 
                    
349        error(['Output nr. ' narglist{jj,1} ' is not present in the assignment list of outputs !']); 
                    
350      end
                    
                
nsISHistory.h http://firefox-mac-pdf.googlecode.com/svn/trunk/ | C Header | 313 lines
                    
94   *                          the index is obtained successfully.
                    
95   *                          <code>NS_ERROR_FAILURE</code> Error in obtaining
                    
96   *                          history entry for the given index.
                    
112   * @throws                  <code>NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA</code> Purge was vetod.
                    
113   * @throws                  <code>NS_ERROR_FAILURE</code> numEntries is
                    
114   *                          invalid or out of bounds with the size of history.
                    
206#define NS_FORWARD_SAFE_NSISHISTORY(_to) \
                    
207  NS_SCRIPTABLE NS_IMETHOD GetCount(PRInt32 *aCount) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCount(aCount); } \
                    
208  NS_SCRIPTABLE NS_IMETHOD GetIndex(PRInt32 *aIndex) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetIndex(aIndex); } \
                    
208  NS_SCRIPTABLE NS_IMETHOD GetIndex(PRInt32 *aIndex) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetIndex(aIndex); } \
                    
209  NS_SCRIPTABLE NS_IMETHOD GetRequestedIndex(PRInt32 *aRequestedIndex) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetRequestedIndex(aRequestedIndex); } \
                    
210  NS_SCRIPTABLE NS_IMETHOD GetMaxLength(PRInt32 *aMaxLength) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetMaxLength(aMaxLength); } \
                    
210  NS_SCRIPTABLE NS_IMETHOD GetMaxLength(PRInt32 *aMaxLength) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetMaxLength(aMaxLength); } \
                    
211  NS_SCRIPTABLE NS_IMETHOD SetMaxLength(PRInt32 aMaxLength) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetMaxLength(aMaxLength); } \
                    
212  NS_SCRIPTABLE NS_IMETHOD GetEntryAtIndex(PRInt32 index, PRBool modifyIndex, nsIHistoryEntry **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetEntryAtIndex(index, modifyIndex, _retval); } \
                    
                
nsIDOMHTMLAppletElement.h http://firefox-mac-pdf.googlecode.com/svn/trunk/ | C Header | 309 lines
                    
138#define NS_FORWARD_SAFE_NSIDOMHTMLAPPLETELEMENT(_to) \
                    
139  NS_SCRIPTABLE NS_IMETHOD GetAlign(nsAString & aAlign) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetAlign(aAlign); } \
                    
140  NS_SCRIPTABLE NS_IMETHOD SetAlign(const nsAString & aAlign) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetAlign(aAlign); } \
                    
140  NS_SCRIPTABLE NS_IMETHOD SetAlign(const nsAString & aAlign) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetAlign(aAlign); } \
                    
141  NS_SCRIPTABLE NS_IMETHOD GetAlt(nsAString & aAlt) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetAlt(aAlt); } \
                    
142  NS_SCRIPTABLE NS_IMETHOD SetAlt(const nsAString & aAlt) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetAlt(aAlt); } \
                    
142  NS_SCRIPTABLE NS_IMETHOD SetAlt(const nsAString & aAlt) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetAlt(aAlt); } \
                    
143  NS_SCRIPTABLE NS_IMETHOD GetArchive(nsAString & aArchive) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetArchive(aArchive); } \
                    
144  NS_SCRIPTABLE NS_IMETHOD SetArchive(const nsAString & aArchive) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetArchive(aArchive); } \
                    
144  NS_SCRIPTABLE NS_IMETHOD SetArchive(const nsAString & aArchive) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetArchive(aArchive); } \
                    
145  NS_SCRIPTABLE NS_IMETHOD GetCode(nsAString & aCode) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCode(aCode); } \
                    
146  NS_SCRIPTABLE NS_IMETHOD SetCode(const nsAString & aCode) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetCode(aCode); } \
                    
146  NS_SCRIPTABLE NS_IMETHOD SetCode(const nsAString & aCode) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetCode(aCode); } \
                    
147  NS_SCRIPTABLE NS_IMETHOD GetCodeBase(nsAString & aCodeBase) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCodeBase(aCodeBase); } \
                    
148  NS_SCRIPTABLE NS_IMETHOD SetCodeBase(const nsAString & aCodeBase) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetCodeBase(aCodeBase); } \
                    
                
resman.py http://migrid.googlecode.com/svn/trunk/ | Python | 299 lines
                    
66    if not validate_status:
                    
67        return (accepted, returnvalues.CLIENT_ERROR)
                    
68
                    
                
Daemon.pm git://github.com/kraih/mojo.git | Perl | 542 lines
                    
95      my $req = $tx->req;
                    
96      if (my $error = $req->error) { $self->_debug($id, $error->{message}) }
                    
97
                    
110      $tx->res->headers->connection('close')
                    
111        if ($c->{requests} || 1) >= $self->max_requests || $req->error;
                    
112
                    
156  # Close connection if necessary
                    
157  return $self->_remove($id) if $tx->error || !$tx->keep_alive;
                    
158
                    
204      $stream->on(close => sub { $self && $self->_close($id) });
                    
205      $stream->on(error =>
                    
206          sub { $self && $self->app->log->error(pop) && $self->_close($id) });
                    
                
edit_expando.jsp git://github.com/liferay/liferay-portal.git | JavaServer Pages | 294 lines
                    
70
                    
71	<liferay-ui:error exception="<%= ColumnNameException.class %>" message="please-enter-a-valid-name" />
                    
72	<liferay-ui:error exception="<%= ColumnTypeException.class %>" message="please-select-a-valid-type" />
                    
72	<liferay-ui:error exception="<%= ColumnTypeException.class %>" message="please-select-a-valid-type" />
                    
73	<liferay-ui:error exception="<%= DuplicateColumnNameException.class %>" message="please-enter-a-unique-name" />
                    
74	<liferay-ui:error exception="<%= ValueDataException.class %>" message="please-enter-a-valid-value" />
                    
                
WebsiteServiceHttp.java git://github.com/liferay/liferay-portal.git | Java | 273 lines
                    
90
                    
91			_log.error(systemException, systemException);
                    
92
                    
126
                    
127			_log.error(systemException, systemException);
                    
128
                    
166
                    
167			_log.error(systemException, systemException);
                    
168
                    
208
                    
209			_log.error(systemException, systemException);
                    
210
                    
249
                    
250			_log.error(systemException, systemException);
                    
251
                    
                
gib_buffer.c https://quake.svn.sourceforge.net/svnroot/quake | C | 339 lines
                    
170			"-----------------\n"
                    
171			"|GIB Parse Error|\n"
                    
172			"-----------------\n"
                    
172			"-----------------\n"
                    
173			"Parse error while adding text to GIB buffer.\n"
                    
174			"Line %u: %s\n", 
                    
174			"Line %u: %s\n", 
                    
175			GIB_Buffer_Get_Line_Num (str, GIB_Parse_ErrorPos ()),
                    
176			GIB_Parse_ErrorMsg ()
                    
202			"-----------------\n"
                    
203			"|GIB Parse Error|\n"
                    
204			"-----------------\n"
                    
204			"-----------------\n"
                    
205			"Parse error while inserting text into GIB buffer.\n"
                    
206			"Line %u: %s\n",
                    
                
DataTxTests.java http://hypergraphdb.googlecode.com/svn/trunk/ | Java | 0 lines
                    
28
                    
29    private ArrayList<Throwable> errors = new ArrayList<Throwable>();
                    
30
                    
194                        t.printStackTrace(System.err);
                    
195                        errors.add(t);
                    
196                    }
                    
209        }
                    
210        assertEquals(errors.size(), 0);
                    
211        verifyData();
                    
                
home.php http://n-13news.googlecode.com/svn/trunk/ | PHP | 164 lines
                    
60if(ini_get("register_globals")){
                    
61	echo "<div class=\"error-warning\">";
                    
62	echo $langmsg['home'][3];
                    
69		echo "<form method=\"post\" action=\"?\">";
                    
70		echo "<div class=\"error-warning\">";
                    
71		echo $langmsg['home'][4] . "<br /><br />" . $langmsg['home'][21];
                    
79		if(!@unlink("install/index.php")){
                    
80			echo "<span class=error>";
                    
81			echo $langmsg['home'][5];
                    
                
CultureHelperHttpModule.cs https://hg01.codeplex.com/mojoportal | C# | 169 lines
                    
19        {
                    
20            application.Error += new EventHandler(this.Error);
                    
21            application.BeginRequest += new EventHandler(BeginRequest);
                    
51            // culture, but you should make sure that the resource file for the default culture 
                    
52            // has no missing keys or runtime errors could occur
                    
53
                    
87                    {
                    
88                        log.Info("swallowed error in culture helper", ex);
                    
89                    }
                    
91                    {
                    
92                        log.Info("swallowed error in culture helper", ex);
                    
93                    }
                    
120                        //can happen in medium trust
                    
121                        log.Error(ex);
                    
122                    }
                    
                
pack.c https://gnukeyring.svn.sourceforge.net/svnroot/gnukeyring | C | 243 lines
                    
35 *
                    
36 * ``May display a fatal error message if any of the following
                    
37 * occur: [] You don t have write access to the database. []
                    
47 *
                    
48 * TODO: Better error checking that e.g. we're not running past the
                    
49 * end of the record.  Display an error dialog rather than crashing.
                    
159 errOut:
                    
160    UI_ReportSysError2(ID_KeyDatabaseAlert, err, __FUNCTION__);
                    
161    return err;
                    
170    if (!recHandle) {
                    
171	UI_ReportSysError2(ID_KeyDatabaseAlert, DmGetLastErr(),
                    
172                           __FUNCTION__);
                    
194 fail:
                    
195     UI_ReportSysError2(ID_KeyDatabaseAlert, err, __FUNCTION__);
                    
196}
                    
                
test_node_stream.py https://bitbucket.org/Stiivi/brewery/ | Python | 221 lines
                    
49
                    
50        self.assertRaises(KeyError, self.stream.connect, "sample", "unknown")
                    
51
                    
52        node = Node()
                    
53        self.assertRaises(KeyError, self.stream.add, node, "sample")
                    
54        
                    
194
                    
195        self.assertRaisesRegexp(StreamRuntimeError, "This is fail node", stream.run)
                    
196        
                    
200            stream.run()
                    
201        except StreamRuntimeError, e:
                    
202            handle = StringIO.StringIO()
                    
219
                    
220        self.assertRaises(StreamRuntimeError, stream.run)
                    
221    
                    
                
securepyro.py http://migrid.googlecode.com/svn/trunk/ | Python | 240 lines
                    
140        if not os.path.isfile(key_path):
                    
141            raise ValueError("No such server key: %s" % key_path)
                    
142        if not os.path.isfile(cert_path):
                    
142        if not os.path.isfile(cert_path):
                    
143            raise ValueError("No such server certificate: %s" % cert_path)
                    
144        # requires m2crypto module, concatenated ssl key/cert and cacert
                    
                
surfaces.c https://quake.svn.sourceforge.net/svnroot/quake | C | 463 lines
                    
94			if (!front || !back)
                    
95				Sys_Error ("SubdivideFace: didn't split the polygon");
                    
96			*prevptr = back;
                    
286	if (hv->num == MAX_MAP_VERTS)
                    
287		Sys_Error ("GetVertex: MAX_MAP_VERTS");
                    
288	hvert_p++;
                    
291	if (bsp->numvertexes == MAX_MAP_VERTS)
                    
292		Sys_Error ("numvertexes == MAX_MAP_VERTS");
                    
293
                    
318	if (!f->contents[0])
                    
319		Sys_Error ("GetEdge: 0 contents");
                    
320
                    
334	if (bsp->numedges == MAX_MAP_EDGES)
                    
335		Sys_Error ("numedges == MAX_MAP_EDGES");
                    
336	edge.v[0] = v1;
                    
                
qfplist.c https://quake.svn.sourceforge.net/svnroot/quake | C | 496 lines
                    
210	if (pl->pos >= pl->end) {
                    
211		pl->error = "Reached end of string while parsing quoted string";
                    
212		return NULL;
                    
340			if (key->type != QFString) {
                    
341				pl->error = "Key is not a string";
                    
342				PL_FreeItem (key);
                    
346			if (pl->ptr[pl->pos] != '=') {
                    
347				pl->error = "Unexpected character (expected '=')";
                    
348				PL_FreeItem (key);
                    
367			} else if (pl->ptr[pl->pos] != '}') {
                    
368				pl->error = "Unexpected character (wanted ';' or '}')";
                    
369				PL_FreeItem (key);
                    
489	} else {
                    
490		if (pl && pl->error && pl->error[0])
                    
491			Sys_Error ("%d,%d: %s", pl->line, pl->pos, pl->error);
                    
                
README.markdown git://github.com/geofflane/grails-constraints.git | Markdown | 316 lines
                    
761. false
                    
772. A String which is used as the error message to show the user
                    
783. A Collection with first element being message code, and following elements being message parameters
                    
842. The target object being validated
                    
853. The validation errors collection
                    
86
                    
87e.g.
                    
88	def validate = { thePropertyValue, theTargetObject, errorsListYouProbablyWontEverNeed ->
                    
89		return null != thePropertyValue && theTargetObject.rocks()
                    
123### defaultMessageCode property (optional) ###
                    
124The defaultMessageCode property defines the default key that will be used to look up the error message
                    
125in the *grails-app/i18n/messages.properties* files.
                    
132### failureCode property (optional) ###
                    
133The failureCode property defines a key that can be used to lookup error messages in the *grails-app/i18n/messages.properties* files.
                    
134The value of this property is appended to the end of the Class.property name that the Constraint is applied to.
                    
                
CGIHTTPServer.py https://bitbucket.org/pypy/pypy/ | Python | 378 lines
                    
148            if not (self.have_fork or self.have_popen2 or self.have_popen3):
                    
149                self.send_error(403, "CGI script is not a Python script (%r)" %
                    
150                                scriptname)
                    
152            if not self.is_executable(scriptfile):
                    
153                self.send_error(403, "CGI script is not executable (%r)" %
                    
154                                scriptname)
                    
247                    os.setuid(nobody)
                    
248                except os.error:
                    
249                    pass
                    
253            except:
                    
254                self.server.handle_error(self.request, self.client_address)
                    
255                os._exit(127)
                    
272                nbytes = int(length)
                    
273            except (TypeError, ValueError):
                    
274                nbytes = 0
                    
                
SpellCheckPlugin.java https://jedit.svn.sourceforge.net/svnroot/jedit | Java | 414 lines
                    
160    {
                    
161      Log.log(Log.ERROR, SpellCheckPlugin.class, "Error spell checking (Aspell).");
                    
162      Log.log(Log.ERROR, SpellCheckPlugin.class, e);
                    
235    {
                    
236      Log.log(Log.ERROR, SpellCheckPlugin.class, "Error spell checking (Aspell).");
                    
237      Log.log(Log.ERROR, SpellCheckPlugin.class, e);
                    
282  private static
                    
283  ErrorListSpellChecker getErrorListSpellChecker()
                    
284  {
                    
291    if( _errorListSpellChecker == null )
                    
292      _errorListSpellChecker = new ErrorListSpellChecker( aspellExeFilename, aspellCommandLine );
                    
293    else
                    
297        _errorListSpellChecker.stop();
                    
298        _errorListSpellChecker = new ErrorListSpellChecker( aspellExeFilename, aspellCommandLine );
                    
299      }
                    
                
PHPParserTester.java https://jedit.svn.sourceforge.net/svnroot/jedit | Java | 350 lines
                    
59		checkPHP("$link= mysql_connect($this->mysqlHost, $this->mysqlUser, $this->mysqlPassword)\n" +
                    
60			"or $errMsg= 'Could not connect: ' . mysql_error();");
                    
61		checkPHP("function method(array $array) {\n}");
                    
136		checkPHP("unset($this->blockvariables[$block][$varname]);");
                    
137		checkPHP("new IT_Error(\"The block '$block' was not found in the template.\", __FILE__, __LINE__);");
                    
138		checkPHP("for ($i=156, $j=0; $i<512; $i++, $j++) $v_checksum += ord(substr($v_binary_data_last,$j,1));");
                    
182		checkPHP("$ol = new Overlib();");
                    
183		checkPHP("$risultato = mysql_query($sql) or\n    die(mysql_error());");
                    
184		checkHTML("\n\n\n\n  <?php print \"Hello world\" ?>");
                    
263		}
                    
264		catch (Error e)
                    
265		{
                    
325
                    
326	public void parseError(PHPParseErrorEvent e)
                    
327	{
                    
                
base.py https://bitbucket.org/mirror/django/ | Python | 231 lines
                    
35                dot = middleware_path.rindex('.')
                    
36            except ValueError:
                    
37                raise exceptions.ImproperlyConfigured, '%s isn\'t a middleware module' % middleware_path
                    
40                mod = import_module(mw_module)
                    
41            except ImportError, e:
                    
42                raise exceptions.ImproperlyConfigured, 'Error importing middleware %s: "%s"' % (mw_module, e)
                    
44                mw_class = getattr(mod, mw_classname)
                    
45            except AttributeError:
                    
46                raise exceptions.ImproperlyConfigured, 'Middleware module "%s" does not define a "%s" class' % (mw_module, mw_classname)
                    
70                request = self.request_class(request_env)
                    
71            except UnicodeDecodeError:
                    
72                response = http.HttpResponseBadRequest()
                    
126
                    
127            # Complain if the view returned None (a common error).
                    
128            if response is None:
                    
                
export_import.jsp git://github.com/liferay/liferay-portal.git | JavaServer Pages | 248 lines
                    
88		<liferay-ui:error exception="<%= LARTypeException.class %>" message="please-import-a-lar-file-of-the-correct-type" />
                    
89		<liferay-ui:error exception="<%= LayoutImportException.class %>" message="an-unexpected-error-occurred-while-importing-your-file" />
                    
90
                    
93			<%
                    
94			LocaleException le = (LocaleException)errorException;
                    
95			%>
                    
99
                    
100		<liferay-ui:error exception="<%= NoSuchLayoutException.class %>" message="an-error-occurred-because-the-live-group-does-not-have-the-current-page" />
                    
101		<liferay-ui:error exception="<%= PortletIdException.class %>" message="please-import-a-lar-file-for-the-current-portlet" />
                    
102
                    
103		<liferay-ui:error exception="<%= PortletDataException.class %>">
                    
104
                    
134			<%
                    
135			String errorMessageKey = StringPool.BLANK;
                    
136
                    
                
pinet.h git://github.com/tito/Movid.git | C Header | 400 lines
                    
45//
                    
46// BSD-compatible socket error codes for Win32
                    
47//
                    
278
                    
279    void error(ippeerinfo& peer, int code, const char* defmsg);
                    
280    bool dopoll(int* i, int timeout);
                    
331
                    
332    void error(int code, const char* msg);
                    
333    void open();
                    
                
EditCompanyAction.java git://github.com/liferay/liferay-portal.git | Java | 288 lines
                    
30import com.liferay.portal.WebsiteURLException;
                    
31import com.liferay.portal.kernel.servlet.SessionErrors;
                    
32import com.liferay.portal.kernel.util.Constants;
                    
80
                    
81				if (!SessionErrors.isEmpty(actionRequest)) {
                    
82					setForward(
                    
94			if (e instanceof PrincipalException) {
                    
95				SessionErrors.add(actionRequest, e.getClass());
                    
96
                    
96
                    
97				setForward(actionRequest, "portlet.portal_settings.error");
                    
98			}
                    
116
                    
117					SessionErrors.add(
                    
118						actionRequest,
                    
                
gen_aircraft.ml git://github.com/pchickey/paparazzi-linux-release.git | OCaml | 280 lines
                    
49	  let other_name = Hashtbl.find ids id in
                    
50	  failwith (sprintf "Error: A/C Id '%s' duplicated in %s (%s and %s)" id conf_xml name other_name)
                    
51	end;
                    
53	  let other_id = Hashtbl.find names name in
                    
54	  failwith (sprintf "Error: A/C name '%s' duplicated in %s (ids %s and %s)" name conf_xml id other_id)
                    
55	end;
                    
                
d_sprite.c https://quake.svn.sourceforge.net/svnroot/quake | C | 419 lines
                    
125				else if (snext < 8)
                    
126					snext = 8;			// prevent round-off error on <0
                    
127										// steps from
                    
134				else if (tnext < 8)
                    
135					tnext = 8;			// guard against round-off error on
                    
136										// <0 steps
                    
153				else if (snext < 8)
                    
154					snext = 8;			// prevent round-off error on <0 steps
                    
155										// from from causing overstepping &
                    
161				else if (tnext < 8)
                    
162					tnext = 8;			// guard against round-off error on
                    
163										// <0 steps
                    
                
RendererImpl.java git://github.com/liferay/liferay-portal.git | Java | 425 lines
                    
172		catch (Exception e) {
                    
173			_log.error(e, e);
                    
174
                    
                
appengine_config.py https://code.google.com/p/pageforest/ | Python | 228 lines
                    
64# the web UI when an exception occurs.  (Tracebacks are always logged
                    
65# at the ERROR level as well.)
                    
66
                    
                
PollsQuestionServiceHttp.java git://github.com/liferay/liferay-portal.git | Java | 235 lines
                    
95		catch (com.liferay.portal.kernel.exception.SystemException se) {
                    
96			_log.error(se, se);
                    
97
                    
128		catch (com.liferay.portal.kernel.exception.SystemException se) {
                    
129			_log.error(se, se);
                    
130
                    
165		catch (com.liferay.portal.kernel.exception.SystemException se) {
                    
166			_log.error(se, se);
                    
167
                    
210		catch (com.liferay.portal.kernel.exception.SystemException se) {
                    
211			_log.error(se, se);
                    
212
                    
                
mel-b-ccl.el git://github.com/wanderlust/flim.git | Emacs Lisp | 481 lines
                    
260	      (write-repeat r4))
                    
261	     ;; error: BB=B 
                    
262	     ((write (r4 & 255))
                    
472      (base64-ccl-decode-string string)
                    
473    (error "Invalid encoded-text %s" string)))
                    
474
                    
                
nsICmdLineHandler.h https://hg01.codeplex.com/kmbrasil | C Header | 0 lines
                    
30{ \
                    
31    if (!aDefaultArgs) return NS_ERROR_FAILURE; \
                    
32    *aDefaultArgs = ToNewUnicode(nsDependentCString(macro_default_args)); \
                    
37{ \
                    
38    if (!aChromeUrlForTask) return NS_ERROR_FAILURE; \
                    
39    *aChromeUrlForTask = PL_strdup(macro_chrome_url); \
                    
44{ \
                    
45    if (!aCommandLineArgument) return NS_ERROR_FAILURE; \
                    
46    *aCommandLineArgument = PL_strdup(macro_cmd_line_arg); \
                    
50{ \
                    
51    if (!aPrefNameForStartup) return NS_ERROR_FAILURE; \
                    
52    *aPrefNameForStartup = PL_strdup(macro_pref_name); \
                    
56{ \
                    
57    if (!aHelpText) return NS_ERROR_FAILURE; \
                    
58    *aHelpText = PL_strdup(macro_help_text); \
                    
                
MessageProcessor.java git://github.com/lmco/eurekastreams.git | Java | 337 lines
                    
153     * @throws MessagingException
                    
154     *             On error.
                    
155     * @throws IOException
                    
155     * @throws IOException
                    
156     *             On error.
                    
157     */
                    
264            // notify user on failure
                    
265            // Note: A response is only sent for errors processing the action (which could be due to missing content
                    
266            // from the message). This is because any errors encountered prior represent a bad sender or ill-formed
                    
280     * @throws MessagingException
                    
281     *             On error.
                    
282     */
                    
300     * @throws MessagingException
                    
301     *             On error.
                    
302     */
                    
                
configuration.jsp git://github.com/liferay/liferay-portal.git | JavaServer Pages | 272 lines
                    
103
                    
104	<liferay-ui:error key="emailFromAddress" message="please-enter-a-valid-email-address" />
                    
105	<liferay-ui:error key="emailFromName" message="please-enter-a-valid-name" />
                    
105	<liferay-ui:error key="emailFromName" message="please-enter-a-valid-name" />
                    
106	<liferay-ui:error key="emailArticleAddedBody" message="please-enter-a-valid-body" />
                    
107	<liferay-ui:error key="emailArticleAddedSubject" message="please-enter-a-valid-subject" />
                    
107	<liferay-ui:error key="emailArticleAddedSubject" message="please-enter-a-valid-subject" />
                    
108	<liferay-ui:error key="emailArticleApprovalDeniedBody" message="please-enter-a-valid-body" />
                    
109	<liferay-ui:error key="emailArticleApprovalDeniedSubject" message="please-enter-a-valid-subject" />
                    
109	<liferay-ui:error key="emailArticleApprovalDeniedSubject" message="please-enter-a-valid-subject" />
                    
110	<liferay-ui:error key="emailArticleApprovalGrantedBody" message="please-enter-a-valid-body" />
                    
111	<liferay-ui:error key="emailArticleApprovalGrantedSubject" message="please-enter-a-valid-subject" />
                    
111	<liferay-ui:error key="emailArticleApprovalGrantedSubject" message="please-enter-a-valid-subject" />
                    
112	<liferay-ui:error key="emailArticleApprovalRequestedBody" message="please-enter-a-valid-body" />
                    
113	<liferay-ui:error key="emailArticleApprovalRequestedSubject" message="please-enter-a-valid-subject" />
                    
                
ResolvedArrayBytecodeExpr.java git://github.com/groovypp/groovypp.git | Java | 303 lines
                    
201            if (methodNode == null) {
                    
202                compiler.addError("Cannot find method " + methodName + "() for type " + PresentationUtil.getText(vtype), exp);
                    
203                return null;
                    
263            if (methodNode == null) {
                    
264                compiler.addError("Cannot find method " + methodName + "() for type " + PresentationUtil.getText(vtype), exp);
                    
265                return null;
                    
                
lilyString.py http://music21.googlecode.com/svn/trunk/ | Python | 440 lines
                    
34    noPIL = False
                    
35except ImportError:
                    
36    noPIL = True
                    
                
VectorMapRenderer.java http://ametro.googlecode.com/svn/trunk/ | Java | 475 lines
                    
183			}
                    
184		}catch(OutOfMemoryError ex){
                    
185			// eat out-of-memory exception
                    
                
move_thread.jsp git://github.com/liferay/liferay-portal.git | JavaServer Pages | 142 lines
                    
50
                    
51	<liferay-ui:error exception="<%= MessageBodyException.class %>" message="please-enter-a-valid-message" />
                    
52	<liferay-ui:error exception="<%= MessageSubjectException.class %>" message="please-enter-a-valid-subject" />
                    
52	<liferay-ui:error exception="<%= MessageSubjectException.class %>" message="please-enter-a-valid-subject" />
                    
53	<liferay-ui:error exception="<%= NoSuchCategoryException.class %>" message="please-enter-a-valid-category" />
                    
54
                    
                
ContentTransformerListener.java git://github.com/liferay/liferay-portal.git | Java | 222 lines
                    
91		catch (Exception e) {
                    
92			_log.error(e, e);
                    
93		}
                    
                
debug.py https://bitbucket.org/mirror/django/ | Python | 657 lines
                    
84                    for t in source_list_func(str(exc_value))]
                    
85            except (ImportError, AttributeError):
                    
86                template_list = []
                    
128def technical_404_response(request, exception):
                    
129    "Create a technical 404 error response. The exception should be the Http404."
                    
130    try:
                    
131        tried = exception.args[0]['tried']
                    
132    except (IndexError, TypeError):
                    
133        tried = []
                    
150def empty_urlconf(request):
                    
151    "Create an empty URLconf 404 error response."
                    
152    t = Template(EMPTY_URLCONF_TEMPLATE)
                    
172        return lower_bound, pre_context, context_line, post_context
                    
173    except (OSError, IOError):
                    
174        return None, [], None, []
                    
                
translation.py https://bitbucket.org/mirror/django/ | Python | 487 lines
                    
13    hasThreads = True
                    
14except ImportError:
                    
15    hasThreads = False
                    
74            self.set_output_charset(settings.DEFAULT_CHARSET)
                    
75        except AttributeError:
                    
76            pass
                    
151                return t
                    
152            except IOError, e:
                    
153                return None
                    
221            return to_language(t.language())
                    
222        except AttributeError:
                    
223            pass
                    
422                else:
                    
423                    raise SyntaxError, "Translation blocks must not include other block tags: %s" % t.contents
                    
424            elif t.token_type == TOKEN_VAR:
                    
                
main.py https://bitbucket.org/mirror/django/ | Python | 681 lines
                    
13    from django.models.admin import log
                    
14except ImportError:
                    
15    raise ImproperlyConfigured, "You don't have 'django.contrib.admin' in INSTALLED_APPS."
                    
43        mod = meta.get_module(app_label, module_name)
                    
44    except ImportError:
                    
45        raise Http404 # Invalid app or module name. Maybe it's not in INSTALLED_APPS.
                    
114            self.page_num = int(request.GET.get(PAGE_VAR, 0))
                    
115        except ValueError:
                    
116            self.page_num = 0
                    
186                        order_field = f.name
                    
187            except (IndexError, ValueError):
                    
188                pass # Invalid ordering specified. Just use the default.
                    
333    def html_error_list(self):
                    
334        return " ".join([form_field.html_error_list() for form_field in self.form_fields if form_field.errors])
                    
335
                    
                
templates.py https://bitbucket.org/mirror/django/ | Python | 398 lines
                    
67    # A variable may not contain more than one word
                    
68    'basic-syntax06': ("{{ multi word variable }}", {}, template.TemplateSyntaxError),
                    
69
                    
69
                    
70    # Raise TemplateSyntaxError for empty variable tags
                    
71    'basic-syntax07': ("{{ }}",        {}, template.TemplateSyntaxError),
                    
71    'basic-syntax07': ("{{ }}",        {}, template.TemplateSyntaxError),
                    
72    'basic-syntax08': ("{{        }}", {}, template.TemplateSyntaxError),
                    
73
                    
82
                    
83    # Raise TemplateSyntaxError when trying to access a variable beginning with an underscore
                    
84    'basic-syntax12': ("{{ var.__dict__ }}", {"var": SomeClass()}, template.TemplateSyntaxError),
                    
85
                    
86    # Raise TemplateSyntaxError when trying to access a variable containing an illegal character
                    
87    'basic-syntax13': ("{{ va>r }}", {}, template.TemplateSyntaxError),
                    
                
management.py https://bitbucket.org/mirror/django/ | Python | 1671 lines
                    
32style = dummy()
                    
33style.ERROR = termcolors.make_style(fg='red', opts=('bold',))
                    
34style.ERROR_OUTPUT = termcolors.make_style(fg='red', opts=('bold',))
                    
111        # hasn't set DATABASE_ENGINE.
                    
112        sys.stderr.write(style.ERROR("Error: Django doesn't know which syntax to use for your SQL statements,\n" +
                    
113            "because you haven't specified the DATABASE_ENGINE setting.\n" +
                    
                
tests.py https://bitbucket.org/mirror/django/ | Python | 702 lines
                    
31
                    
32        # Making sure TypeError is thrown when trying to set with an
                    
33        #  incompatible type.
                    
36                nullcity.point = bad
                    
37            except TypeError:
                    
38                pass
                    
39            else:
                    
40                self.fail('Should throw a TypeError')
                    
41
                    
96        if not postgis:
                    
97            self.assertRaises(NotImplementedError, State.objects.all().kml, field_name='poly')
                    
98            return
                    
99
                    
100        # Should throw a TypeError when trying to obtain KML from a
                    
101        #  non-geometry field.
                    
                
__init__.py https://bitbucket.org/mirror/django/ | Python | 582 lines
                    
2import re
                    
3from Cookie import SimpleCookie, CookieError
                    
4from pprint import pformat
                    
9    from mod_python.util import parse_qsl
                    
10except ImportError:
                    
11    from cgi import parse_qsl
                    
106        if hasattr(self, '_files'):
                    
107            raise AttributeError("You cannot set the upload handlers after the upload has been processed.")
                    
108        self._upload_handlers = upload_handlers
                    
148        for key, value in parse_qsl((query_string or ''), True): # keep_blank_values=True
                    
149            self.appendlist(force_unicode(key, encoding, errors='replace'),
                    
150                            force_unicode(value, encoding, errors='replace'))
                    
266
                    
267class BadHeaderError(ValueError):
                    
268    pass
                    
                
basehttp.py https://bitbucket.org/mirror/django/ | Python | 698 lines
                    
43            return data
                    
44        raise IndexError
                    
45
                    
76        if not isinstance(headers, list):
                    
77            raise TypeError("Headers must be a list of name/value tuples")
                    
78        self._headers = headers
                    
251    traceback_limit = None  # Print entire traceback to self.get_stderr()
                    
252    error_status = "500 INTERNAL SERVER ERROR"
                    
253    error_headers = [('Content-Type','text/plain')]
                    
284            except:
                    
285                # If we get an error handling an error, just give up already!
                    
286                self.close()
                    
330            blocks = len(self.result)
                    
331        except (TypeError, AttributeError, NotImplementedError):
                    
332            pass
                    
                
models.py https://bitbucket.org/mirror/django/ | Python | 660 lines
                    
59            self.assertContains(response, 'thrice')
                    
60        except AssertionError, e:
                    
61            self.assertEquals(str(e), "Couldn't find 'thrice' in response")
                    
129            self.assertTemplateNotUsed(response, 'base.html')
                    
130        except AssertionError, e:
                    
131            self.assertEquals(str(e), "Template 'base.html' was used unexpectedly in rendering the response")
                    
144            self.assertRedirects(response, '/test_client/get_view/')
                    
145        except AssertionError, e:
                    
146            self.assertEquals(str(e), "Response didn't redirect as expected: Response code was 301 (expected 302)")
                    
289        try:
                    
290            self.assertFormError(response, 'wrong_form', 'some_field', 'Some error.')
                    
291        except AssertionError, e:
                    
307        try:
                    
308            self.assertFormError(response, 'form', 'some_field', 'Some error.')
                    
309        except AssertionError, e:
                    
                
related.py https://bitbucket.org/mirror/django/ | Python | 1072 lines
                    
53            app_label, model_name = relation.split(".")
                    
54        except ValueError:
                    
55            # If we can't split, assume a model in current app
                    
57            model_name = relation
                    
58        except AttributeError:
                    
59            # If it doesn't have a split it's actually a model class
                    
133                    v, field = getattr(v, v._meta.pk.name), v._meta.pk
                    
134            except AttributeError:
                    
135                pass
                    
170            return []
                    
171        raise TypeError, "Related Field has invalid lookup: %s" % lookup_type
                    
172
                    
194            return getattr(instance, self.cache_name)
                    
195        except AttributeError:
                    
196            params = {'%s__pk' % self.related.field.name: instance._get_pk_val()}
                    
                
__init__.py https://bitbucket.org/mirror/django/ | Python | 1109 lines
                    
149        for k in translated_keys:
                    
150            self.error_messages[k] = _(self.error_messages[k])
                    
151
                    
189        if errors:
                    
190            raise exceptions.ValidationError(errors)
                    
191
                    
201            if not value in dict(self.choices):
                    
202                raise exceptions.ValidationError(self.error_messages['invalid_choice'] % value)
                    
203
                    
204        if value is None and not self.null:
                    
205            raise exceptions.ValidationError(self.error_messages['null'])
                    
206
                    
207        if not self.blank and value in validators.EMPTY_VALUES:
                    
208            raise exceptions.ValidationError(self.error_messages['blank'])
                    
209
                    
                
base.py https://bitbucket.org/mirror/django/ | Python | 885 lines
                    
5import django.db.models.manager     # Imported to register signal handler.
                    
6from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned, FieldError, ValidationError, NON_FIELD_ERRORS
                    
7from django.core import validators
                    
12from django.db.models.options import Options
                    
13from django.db import connections, transaction, DatabaseError, DEFAULT_DB_ALIAS
                    
14from django.db.models import signals
                    
102                    if parent._meta.fields:
                    
103                        raise TypeError("Abstract base class containing model fields not permitted for proxy model '%s'." % name)
                    
104                    else:
                    
106                if base is not None:
                    
107                    raise TypeError("Proxy model '%s' has more than one non-abstract model base class." % name)
                    
108                else:
                    
110            if base is None:
                    
111                    raise TypeError("Proxy model '%s' has no non-abstract model base class." % name)
                    
112            if (new_class._meta.local_fields or
                    
                
models.py https://bitbucket.org/mirror/django/ | Python | 922 lines
                    
11
                    
12from django.core.exceptions import ValidationError, NON_FIELD_ERRORS, UnresolvableValidationError
                    
13from django.core.validators import EMPTY_VALUES
                    
80    opts = instance._meta
                    
81    if form.errors:
                    
82        raise ValueError("The %s could not be %s because the data didn't"
                    
229    def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None,
                    
230                 initial=None, error_class=ErrorList, label_suffix=':',
                    
231                 empty_permitted=False, instance=None):
                    
255                if k != NON_FIELD_ERRORS:
                    
256                    self._errors.setdefault(k, ErrorList()).extend(v)
                    
257
                    
262            if NON_FIELD_ERRORS in e.message_dict:
                    
263                raise ValidationError(e.message_dict[NON_FIELD_ERRORS])
                    
264
                    
                
forms.py https://bitbucket.org/mirror/django/ | Python | 502 lines
                    
79        self.initial = initial or {}
                    
80        self.error_class = error_class
                    
81        self.label_suffix = label_suffix
                    
138        "Helper function for outputting HTML. Used by as_table(), as_ul(), as_p()."
                    
139        top_errors = self.non_field_errors() # Errors that should be displayed above all fields.
                    
140        output, hidden_fields = [], []
                    
144            bf = BoundField(self, field, name)
                    
145            bf_errors = self.error_class([conditional_escape(error) for error in bf.errors]) # Escape and cache in local variable.
                    
146            if bf.is_hidden:
                    
241        """
                    
242        return self.errors.get(NON_FIELD_ERRORS, self.error_class())
                    
243
                    
287        except ValidationError, e:
                    
288            self._errors[NON_FIELD_ERRORS] = self.error_class(e.messages)
                    
289        if self._errors:
                    
                
fields.py https://bitbucket.org/mirror/django/ | Python | 858 lines
                    
143        if errors:
                    
144            raise ValidationError(errors)
                    
145
                    
299        if self.decimal_places is not None and decimals > self.decimal_places:
                    
300            raise ValidationError(self.error_messages['max_decimal_places'] % self.decimal_places)
                    
301        if self.max_digits is not None and self.decimal_places is not None and whole_digits > (self.max_digits - self.decimal_places):
                    
301        if self.max_digits is not None and self.decimal_places is not None and whole_digits > (self.max_digits - self.decimal_places):
                    
302            raise ValidationError(self.error_messages['max_whole_digits'] % (self.max_digits - self.decimal_places))
                    
303        return value
                    
330                continue
                    
331        raise ValidationError(self.error_messages['invalid'])
                    
332
                    
356                continue
                    
357        raise ValidationError(self.error_messages['invalid'])
                    
358
                    
                
generic.py https://bitbucket.org/mirror/django/ | Python | 411 lines
                    
65            return getattr(instance, self.cache_attr)
                    
66        except AttributeError:
                    
67            rel_obj = None
                    
85        if instance is None:
                    
86            raise AttributeError, u"%s must be accessed via instance" % self.related.opts.object_name
                    
87
                    
212        if instance is None:
                    
213            raise AttributeError, "Manager must be accessed via instance"
                    
214
                    
254                if not isinstance(obj, self.model):
                    
255                    raise TypeError, "'%s' instance expected" % self.model._meta.object_name
                    
256                setattr(obj, self.content_type_field_name, self.content_type)
                    
                
options.py https://bitbucket.org/mirror/django/ | Python | 1232 lines
                    
10from django.views.decorators.csrf import csrf_protect
                    
11from django.core.exceptions import PermissionDenied, ValidationError
                    
12from django.db import models, transaction
                    
26    set
                    
27except NameError:
                    
28    from sets import Set as set     # Python 2.3 fallback
                    
                
fields.py https://bitbucket.org/mirror/django/ | Python | 853 lines
                    
56
                    
57    def assertRaisesErrorWithMessage(self, error, message, callable, *args, **kwargs):
                    
58        self.assertRaises(error, callable, *args, **kwargs)
                    
85        self.assertEqual(u'1234567890', f.clean('1234567890'))
                    
86        self.assertRaisesErrorWithMessage(ValidationError, "[u'Ensure this value has at most 10 characters (it has 11).']", f.clean, '1234567890a')
                    
87
                    
90        self.assertEqual(u'', f.clean(''))
                    
91        self.assertRaisesErrorWithMessage(ValidationError, "[u'Ensure this value has at least 10 characters (it has 5).']", f.clean, '12345')
                    
92        self.assertEqual(u'1234567890', f.clean('1234567890'))
                    
174        self.assertEqual(42.0, f.clean(42))
                    
175        self.assertRaisesErrorWithMessage(ValidationError, "[u'Enter a number.']", f.clean, 'a')
                    
176        self.assertEqual(1.0, f.clean('1.0 '))
                    
178        self.assertEqual(1.0, f.clean(' 1.0 '))
                    
179        self.assertRaisesErrorWithMessage(ValidationError, "[u'Enter a number.']", f.clean, '1.0a')
                    
180
                    
                
models.py https://bitbucket.org/mirror/django/ | Python | 1117 lines
                    
6    sorted
                    
7except NameError:
                    
8    from django.utils.itercompat import sorted
                    
                
models.py https://bitbucket.org/mirror/django/ | Python | 1585 lines
                    
135            return self.description
                    
136except ImportError:
                    
137    test_images = False
                    
448
                    
449If you call save() with invalid data, you'll get a ValueError.
                    
450>>> f = CategoryForm({'name': '', 'slug': 'not a slug!', 'url': 'foo'})
                    
450>>> f = CategoryForm({'name': '', 'slug': 'not a slug!', 'url': 'foo'})
                    
451>>> f.errors['name']
                    
452[u'This field is required.']
                    
452[u'This field is required.']
                    
453>>> f.errors['slug']
                    
454[u"Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens."]
                    
457...
                    
458AttributeError: 'CategoryForm' object has no attribute 'cleaned_data'
                    
459>>> f.save()
                    
                
__init__.py https://bitbucket.org/mirror/django/ | Python | 915 lines
                    
7    import decimal
                    
8except ImportError:
                    
9    from django.utils import _decimal as decimal    # for Python 2.3
                    
115        Converts the input value into the expected Python data type, raising
                    
116        django.core.exceptions.ValidationError if the data can't be converted.
                    
117        Returns the converted value. Subclasses should override this.
                    
143            return connection.creation.data_types[self.get_internal_type()] % data
                    
144        except KeyError:
                    
145            return None
                    
225                value = int(value)
                    
226            except ValueError:
                    
227                raise ValueError("The __year lookup type requires an integer argument")
                    
353            return int(value)
                    
354        except (TypeError, ValueError):
                    
355            raise exceptions.ValidationError(
                    
                
models.py https://bitbucket.org/mirror/django/ | Python | 1037 lines
                    
239        bad_fields.union(field_errors)
                    
240        form_errors.extend(global_errors)
                    
241
                    
241
                    
242        field_errors, global_errors = self._perform_date_checks(date_checks)
                    
243        bad_fields.union(field_errors)
                    
243        bad_fields.union(field_errors)
                    
244        form_errors.extend(global_errors)
                    
245
                    
325                if len(unique_check) == 1:
                    
326                    self._errors[unique_check[0]] = ErrorList([self.unique_error_message(unique_check)])
                    
327                else:
                    
327                else:
                    
328                    form_errors.append(self.unique_error_message(unique_check))
                    
329
                    
                
forms.py https://bitbucket.org/mirror/django/ | Python | 460 lines
                    
13from widgets import Media, media_property, TextInput, Textarea
                    
14from util import flatatt, ErrorDict, ErrorList, ValidationError
                    
15
                    
138        "Helper function for outputting HTML. Used by as_table(), as_ul(), as_p()."
                    
139        top_errors = self.non_field_errors() # Errors that should be displayed above all fields.
                    
140        output, hidden_fields = [], []
                    
142            bf = BoundField(self, field, name)
                    
143            bf_errors = self.error_class([conditional_escape(error) for error in bf.errors]) # Escape and cache in local variable.
                    
144            if bf.is_hidden:
                    
166        if top_errors:
                    
167            output.insert(0, error_row % force_unicode(top_errors))
                    
168        if hidden_fields: # Insert any hidden fields in the last row.
                    
205        """
                    
206        return self.errors.get(NON_FIELD_ERRORS, self.error_class())
                    
207
                    
                
fields.py https://bitbucket.org/mirror/django/ | Python | 911 lines
                    
187        if self.max_value is not None and value > self.max_value:
                    
188            raise ValidationError(self.error_messages['max_value'] % self.max_value)
                    
189        if self.min_value is not None and value < self.min_value:
                    
221        if self.min_value is not None and value < self.min_value:
                    
222            raise ValidationError(self.error_messages['min_value'] % self.min_value)
                    
223        return value
                    
270        if self.min_value is not None and value < self.min_value:
                    
271            raise ValidationError(self.error_messages['min_value'] % self.min_value)
                    
272        if self.max_digits is not None and digits > self.max_digits:
                    
314                continue
                    
315        raise ValidationError(self.error_messages['invalid'])
                    
316
                    
346                continue
                    
347        raise ValidationError(self.error_messages['invalid'])
                    
348
                    
                
options.py https://bitbucket.org/mirror/django/ | Python | 1229 lines
                    
27    set
                    
28except NameError:
                    
29    from sets import Set as set     # Python 2.3 fallback
                    
                
sites.py https://bitbucket.org/mirror/django/ | Python | 515 lines
                    
17    set
                    
18except NameError:
                    
19    from sets import Set as set     # Python 2.3 fallback
                    
20
                    
21ERROR_MESSAGE = ugettext_lazy("Please enter a correct username and password. Note that both fields are case-sensitive.")
                    
22LOGIN_FORM_KEY = 'this_is_the_login_form'
                    
117        """
                    
118        Disable a globally-registered action. Raises KeyError for invalid names.
                    
119        """
                    
124        Explicitally get a registered global action wheather it's enabled or
                    
125        not. Raises KeyError for invalid names.
                    
126        """
                    
301        if user is None:
                    
302            message = ERROR_MESSAGE
                    
303            if u'@' in username:
                    
                
global_settings.py https://bitbucket.org/mirror/django/ | Python | 450 lines
                    
22
                    
23# People who get code error notifications.
                    
24# In the format (('Full Name', 'email@domain.com'), ('Full Name', 'anotheremail@domain.com'))
                    
118
                    
119# E-mail address that error messages come from.
                    
120SERVER_EMAIL = 'root@localhost'
                    
337
                    
338# The profanities that will trigger a validation error in the
                    
339# 'hasNoProfanities' validator. All of these should be in lowercase.
                    
                
tests.py https://bitbucket.org/mirror/django/ | Python | 1672 lines
                    
26    set
                    
27except NameError:
                    
28    from sets import Set as set
                    
                
runtests.py https://bitbucket.org/mirror/django/ | Python | 399 lines
                    
20    set
                    
21except NameError:
                    
22    from sets import Set as set     # For Python 2.3
                    
81    def runTest(self):
                    
82        from django.core.management.validation import get_validation_errors
                    
83        from django.db.models.loading import load_app
                    
90
                    
91        # Make sure sys.stdout is not a tty so that we get errors without
                    
92        # coloring attached (makes matching the results easier). We restore
                    
96        sys.stdout = s
                    
97        count = get_validation_errors(s, module)
                    
98        sys.stdout = orig_stdout
                    
99        s.seek(0)
                    
100        error_log = s.read()
                    
101        actual = error_log.split('\n')
                    
                
defaultfilters.py https://bitbucket.org/mirror/django/ | Python | 929 lines
                    
6    from decimal import Decimal, InvalidOperation, ROUND_HALF_UP
                    
7except ImportError:
                    
8    from django.utils._decimal import Decimal, InvalidOperation, ROUND_HALF_UP
                    
12    from functools import wraps
                    
13except ImportError:
                    
14    from django.utils.functional import wraps  # Python 2.3, 2.4 fallback.
                    
149        d = Decimal(input_val)
                    
150    except UnicodeEncodeError:
                    
151        return u''
                    
156            d = Decimal(force_unicode(float(text)))
                    
157        except (ValueError, InvalidOperation, TypeError, UnicodeEncodeError):
                    
158            return u''
                    
246        return (u"%" + unicode(arg)) % value
                    
247    except (ValueError, TypeError):
                    
248        return u""
                    
                
__init__.py https://bitbucket.org/mirror/django/ | Python | 975 lines
                    
31Create a compiled template object with a template_string, then call render()
                    
32with a context. In the compilation stage, the TemplateSyntaxError exception
                    
33will be raised if the template doesn't have proper syntax.
                    
105
                    
106class TemplateSyntaxError(Exception):
                    
107    def __str__(self):
                    
109            import cStringIO as StringIO
                    
110        except ImportError:
                    
111            import StringIO
                    
124
                    
125class TemplateEncodingError(Exception):
                    
126    pass
                    
137    def __unicode__(self):
                    
138        return self.msg % tuple([force_unicode(p, errors='replace') for p in self.params])
                    
139
                    
                
trans_real.py https://bitbucket.org/mirror/django/ | Python | 547 lines
                    
68            self.set_output_charset('utf-8')
                    
69        except AttributeError:
                    
70            pass
                    
148                return t
                    
149            except IOError, e:
                    
150                return None
                    
229            return to_language(t.language())
                    
230        except AttributeError:
                    
231            pass
                    
                
widgets.py https://bitbucket.org/mirror/django/ | Python | 731 lines
                    
6    set
                    
7except NameError:
                    
8    from sets import Set as set   # Python 2.3 fallback
                    
49        # if media_attrs != {}:
                    
50        #     raise TypeError, "'class Media' has invalid attribute(s): %s" % ','.join(media_attrs.keys())
                    
51
                    
79            return Media(**{str(name): getattr(self, '_' + name)})
                    
80        raise KeyError('Unknown media type "%s"' % name)
                    
81
                    
156        """
                    
157        raise NotImplementedError
                    
158
                    
                
global_settings.py https://bitbucket.org/mirror/django/ | Python | 478 lines
                    
23
                    
24# People who get code error notifications.
                    
25# In the format (('Full Name', 'email@domain.com'), ('Full Name', 'anotheremail@domain.com'))
                    
123
                    
124# E-mail address that error messages come from.
                    
125SERVER_EMAIL = 'root@localhost'
                    
                
tests.py https://bitbucket.org/mirror/django/ | Python | 350 lines
                    
34
                    
35unicode(string_concat(...)) should not raise a TypeError - #4796
                    
36
                    
170False
                    
171>>> form.errors['float_field']
                    
172[u'Introdu\xefu un n\xfamero.']
                    
172[u'Introdu\xefu un n\xfamero.']
                    
173>>> form.errors['decimal_field']
                    
174[u'Introdu\xefu un n\xfamero.']
                    
174[u'Introdu\xefu un n\xfamero.']
                    
175>>> form.errors['date_field']
                    
176[u'Introdu\xefu una data v\xe0lida.']
                    
176[u'Introdu\xefu una data v\xe0lida.']
                    
177>>> form.errors['datetime_field']
                    
178[u'Introdu\xefu una data/hora v\xe0lides.']
                    
                
models.py https://bitbucket.org/mirror/django/ | Python | 550 lines
                    
184            if person and alive and person.name == "Grace Hopper":
                    
185                raise forms.ValidationError, "Grace is not a Zombie"
                    
186
                    
                
tests.py https://bitbucket.org/mirror/django/ | Python | 1875 lines
                    
12from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
                    
13from django.forms.util import ErrorList
                    
14from django.test import TestCase
                    
28    set
                    
29except NameError:
                    
30    from sets import Set as set
                    
81        A smoke test to ensure GET on the change_view works (returns an HTTP
                    
82        404 error, see #11191) when passing a string as the PK argument for a
                    
83        model with an integer PK field.
                    
                
tests.py https://bitbucket.org/mirror/django/ | Python | 1587 lines
                    
6from django.conf import settings
                    
7from django.core.exceptions import FieldError
                    
8from django.db import DatabaseError, connection, connections, DEFAULT_DB_ALIAS
                    
34                excName = str(exc)
                    
35            raise AssertionError, "%s not raised" % excName
                    
36
                    
358        # Combining querysets built on different models should behave in a well-defined
                    
359        # fashion. We raise an error.
                    
360        self.assertRaisesMessage(
                    
360        self.assertRaisesMessage(
                    
361            AssertionError,
                    
362            'Cannot combine queries on two different ba
                    
                
tests.py https://bitbucket.org/mirror/django/ | Python | 2288 lines
                    
16from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
                    
17from django.forms.util import ErrorList
                    
18from django.test import TestCase
                    
83        A smoke test to ensure GET on the change_view works (returns an HTTP
                    
84        404 error, see #11191) when passing a string as the PK argument for a
                    
85        model with an integer PK field.
                    
                
models.py https://bitbucket.org/mirror/django/ | Python | 865 lines
                    
9from django.core.urlresolvers import reverse
                    
10from django.template import (TemplateDoesNotExist, TemplateSyntaxError,
                    
11    Context, loader)
                    
37            self.assertContains(response, 'text', status_code=999)
                    
38        except AssertionError, e:
                    
39            self.assertEquals(str(e), "Couldn't retrieve page: Response code was 200 (expected 999)")
                    
41            self.assertContains(response, 'text', status_code=999, msg_prefix='abc')
                    
42        except AssertionError, e:
                    
43            self.assertEquals(str(e), "abc: Couldn't retrieve page: Response code was 200 (expected 999)")
                    
46            self.assertNotContains(response, 'text', status_code=999)
                    
47        except AssertionError, e:
                    
48            self.assertEquals(str(e), "Couldn't retrieve page: Response code was 200 (expected 999)")
                    
50            self.assertNotContains(response, 'text', status_code=999, msg_prefix='abc')
                    
51        except AssertionError, e:
                    
52            self.assertEquals(str(e), "abc: Couldn't retrieve page: Response code was 200 (expected 999)")
                    
                
tests.py https://bitbucket.org/mirror/django/ | Python | 668 lines
                    
56        """
                    
57        unicode(string_concat(...)) should not raise a TypeError - #4796
                    
58        """
                    
202            self.assertEqual(False, form.is_valid())
                    
203            self.assertEqual([u'Introdu\xefu un n\xfamero.'], form.errors['float_field'])
                    
204            self.assertEqual([u'Introdu\xefu un n\xfamero.'], form.errors['decimal_field'])
                    
204            self.assertEqual([u'Introdu\xefu un n\xfamero.'], form.errors['decimal_field'])
                    
205            self.assertEqual([u'Introdu\xefu una data v\xe0lida.'], form.errors['date_field'])
                    
206            self.assertEqual([u'Introdu\xefu una data/hora v\xe0lides.'], form.errors['datetime_field'])
                    
206            self.assertEqual([u'Introdu\xefu una data/hora v\xe0lides.'], form.errors['datetime_field'])
                    
207            self.assertEqual([u'Introdu\xefu un n\xfamero sencer.'], form.errors['integer_field'])
                    
208
                    
                
tests.py https://bitbucket.org/mirror/django/ | Python | 758 lines
                    
6from django.conf import settings
                    
7from django.core.exceptions import FieldError
                    
8from django.db import DEFAULT_DB_ALIAS
                    
40        """
                    
41        Regression test for #12822: DatabaseError: aggregates not allowed in
                    
42        WHERE clause
                    
60        """
                    
61        Regression test for #12822: DatabaseError: aggregates not allowed in
                    
62        WHERE clause
                    
93            """
                    
94            # tests that this query does not raise a DatabaseError due to the full
                    
95            # subselect being (erroneously) added to the GROUP BY parameters
                    
266
                    
267    def test_field_error(self):
                    
268        # Bad field requests in aggregates are caught and reported
                    
                
tests.py https://bitbucket.org/mirror/django/ | Python | 376 lines
                    
13from django.core.mail.backends import console, dummy, locmem, filebased, smtp
                    
14from django.core.mail.message import BadHeaderError
                    
15from django.test import TestCase
                    
37        email = EmailMessage('Subject\nInjection Test', 'Content', 'from@example.com', ['to@example.com'])
                    
38        self.assertRaises(BadHeaderError, email.message)
                    
39        email = EmailMessage(ugettext_lazy('Subject\nInjection Test'), 'Content', 'from@example.com', ['to@example.com'])
                    
39        email = EmailMessage(ugettext_lazy('Subject\nInjection Test'), 'Content', 'from@example.com', ['to@example.com'])
                    
40        self.assertRaises(BadHeaderError, email.message)
                    
41
                    
                
fields.py https://bitbucket.org/mirror/django/ | Python | 863 lines
                    
52
                    
53    def assertRaisesErrorWithMessage(self, error, message, callable, *args, **kwargs):
                    
54        self.assertRaises(error, callable, *args, **kwargs)
                    
65        self.assertEqual(u'hello', f.clean('hello'))
                    
66        self.assertRaisesErrorWithMessage(ValidationError, "[u'This field is required.']", f.clean, None)
                    
67        self.assertRaisesErrorWithMessage(ValidationError, "[u'This field is required.']", f.clean, '')
                    
81        self.assertEqual(u'1234567890', f.clean('1234567890'))
                    
82        self.assertRaisesErrorWithMessage(ValidationError, "[u'Ensure this value has at most 10 characters (it has 11).']", f.clean, '1234567890a')
                    
83
                    
86        self.assertEqual(u'', f.clean(''))
                    
87        self.assertRaisesErrorWithMessage(ValidationError, "[u'Ensure this value has at least 10 characters (it has 5).']", f.clean, '12345')
                    
88        self.assertEqual(u'1234567890', f.clean('1234567890'))
                    
92        f = CharField(min_length=10, required=True)
                    
93        self.assertRaisesErrorWithMessage(ValidationError, "[u'This field is required.']", f.clean, '')
                    
94        self.assertRaisesErrorWithMessage(ValidationError, "[u'Ensure this value has at least 10 characters (it has 5).']", f.clean, '12345')
                    
                
formsets.py https://bitbucket.org/mirror/django/ | Python | 764 lines
                    
2from unittest import TestCase
                    
3from django.forms import Form, CharField, IntegerField, ValidationError
                    
4from django.forms.formsets import formset_factory, BaseFormSet
                    
26            if drink['name'] in seen_drinks:
                    
27                raise ValidationError('You may only specify a drink once.')
                    
28
                    
32# Let's define a FormSet that takes a list of favorite drinks, but raises an
                    
33# error if there are any duplicates. Used in ``test_clean_hook``,
                    
34# ``test_regression_6926`` & ``test_regression_12878``.
                    
62        # We treat FormSet pretty much like we would treat a normal Form. FormSet has an
                    
63        # is_valid method, and a cleaned_data or errors attribute depending on whether all
                    
64        # the forms passed validation. However, unlike a Form instance, cleaned_data and
                    
64        # the forms passed validation. However, unlike a Form instance, cleaned_data and
                    
65        # errors will be a list of dicts rather than just a single dict.
                    
66
                    
                
tests.py https://bitbucket.org/mirror/django/ | Python | 612 lines
                    
6    from cStringIO import StringIO
                    
7except ImportError:
                    
8    from StringIO import StringIO
                    
12from django.core.management.commands.dumpdata import sort_dependencies
                    
13from django.core.management.base import CommandError
                    
14from django.db.models import signals
                    
121        Test for ticket #4371 -- Loading data of an unknown format should fail
                    
122        Validate that error conditions are caught correctly
                    
123        """
                    
140        using explicit filename.
                    
141        Validate that error conditions are caught correctly
                    
142        """
                    
159        without file extension.
                    
160        Validate that error conditions are caught correctly
                    
161        """
                    
                
tests.py https://bitbucket.org/mirror/django/ | Python | 1682 lines
                    
18    from models import Article, article_using
                    
19except ImportError:
                    
20    pass
                    
276    def test_m2m_cross_database_protection(self):
                    
277        "Operations that involve sharing M2M objects across databases raise an error"
                    
278        # Create a book and author on the default database
                    
292            self.fail("Shouldn't be able to assign across databases")
                    
293        except ValueError:
                    
294            pass
                    
299            self.fail("Shouldn't be able to assign across databases")
                    
300        except ValueError:
                    
301            pass
                    
306            self.fail("Shouldn't be able to assign across databases")
                    
307        except ValueError:
                    
308            pass
                    
                
models.py https://bitbucket.org/mirror/django/ | Python | 336 lines
                    
9
                    
10class FieldErrors(models.Model):
                    
11    charfield = models.CharField()
                    
206class UniqueFKTarget2(models.Model):
                    
207    """ Model to test for unique FK target in previously seen model: expect no error """
                    
208    tgt = models.ForeignKey(FKTarget, to_field='good')
                    
228
                    
229model_errors = """invalid_models.fielderrors: "charfield": CharFields require a "max_length" attribute that is a positive integer.
                    
230invalid_models.fielderrors: "charfield2": CharFields require a "max_length" attribute that is a positive integer.
                    
232invalid_models.fielderrors: "decimalfield": DecimalFields require a "decimal_places" attribute that is a non-negative integer.
                    
233invalid_models.fielderrors: "decimalfield": DecimalFields require a "max_digits" attribute that is a positive integer.
                    
234invalid_models.fielderrors: "decimalfield2": DecimalFields require a "decimal_places" attribute that is a non-negative integer.
                    
235invalid_models.fielderrors: "decimalfield2": DecimalFields require a "max_digits" attribute that is a positive integer.
                    
236invalid_models.fielderrors: "decimalfield3": DecimalFields require a "decimal_places" attribute that is a non-negative integer.
                    
237invalid_models.fielderrors: "decimalfield3": DecimalFields require a "max_digits" attribute that is a positive integer.
                    
                
models.py https://bitbucket.org/mirror/django/ | Python | 460 lines
                    
194
                    
195        self.assertFormError(response, 'form', 'email', 'This field is required.')
                    
196        self.assertFormError(response, 'form', 'single', 'This field is required.')
                    
196        self.assertFormError(response, 'form', 'single', 'This field is required.')
                    
197        self.assertFormError(response, 'form', 'multi', 'This field is required.')
                    
198
                    
198
                    
199    def test_form_error(self):
                    
200        "POST erroneous data to a form"
                    
211
                    
212        self.assertFormError(response, 'form', 'email', 'Enter a valid e-mail address.')
                    
213
                    
235        response = self.client.post('/test_client/form_view_with_template/', post_data)
                    
236        self.assertContains(response, 'POST data has errors')
                    
237        self.assertTemplateUsed(response, 'form_view.html')
                    
                
fields.py https://bitbucket.org/mirror/django/ | Python | 784 lines
                    
45    except ObjectDoesNotExist:
                    
46        raise validators.ValidationError, "Please enter a valid %s." % f.verbose_name
                    
47
                    
59        return
                    
60    raise validators.ValidationError, "%s with this %s already exists." % (capfirst(opts.verbose_name), f.verbose_name)
                    
61
                    
175            return []
                    
176        raise TypeError, "Field has invalid lookup: %s" % lookup_type
                    
177
                    
                
__init__.py https://bitbucket.org/mirror/django/ | Python | 1716 lines
                    
90            _installed_models_cache.append(__import__(a + '.models', '', '', ['']))
                    
91        except ImportError:
                    
92            pass
                    
113                mod._MODELS
                    
114            except AttributeError:
                    
115                pass # Skip model modules that don't actually have models in them.
                    
223            if is_auto and self.has_auto_field:
                    
224                raise AssertionError, "A model can't have more than one AutoField."
                    
225            elif is_auto:
                    
247        """
                    
248        Returns the requested field by name. Raises FieldDoesNotExist on error.
                    
249        """
                    
293            return self._all_related_objects
                    
294        except AttributeError:
                    
295            module_list = get_installed_model_modules()
                    
                
defaulttags.py https://bitbucket.org/mirror/django/ | Python | 1220 lines
                    
7from django.template import Node, NodeList, Template, Context, Variable
                    
8from django.template import TemplateSyntaxError, VariableDoesNotExist, BLOCK_TAG_START, BLOCK_TAG_END, VARIABLE_TAG_START, VARIABLE_TAG_END, SINGLE_BRACE_START, SINGLE_BRACE_END, COMMENT_TAG_START, COMMENT_TAG_END
                    
9from django.template import get_library, Library, InvalidTemplateLibrary
                    
166                    unpacked_vars = dict(zip(self.loopvars, item))
                    
167                except TypeError:
                    
168                    pass
                    
302            fp.close()
                    
303        except IOError:
                    
304            output = ''
                    
308                return t.render(context)
                    
309            except TemplateSyntaxError, e:
                    
310                if settings.DEBUG:
                    
310                if settings.DEBUG:
                    
311                    return "[Included template had syntax error: %s]" % e
                    
312                else:
                    
                
__init__.py https://bitbucket.org/mirror/django/ | Python | 470 lines
                    
3    from threading import local
                    
4except ImportError:
                    
5    # Import copy of _thread_local.py from Python 2.4
                    
8    set
                    
9except NameError:
                    
10    # Python 2.3 compat
                    
97        """
                    
98        raise NotImplementedError()
                    
99
                    
105        """
                    
106        raise NotImplementedError()
                    
107
                    
151        """
                    
152        raise NotImplementedError('Full-text search is not implemented for this database backend')
                    
153
                    
                
defaulttags.py https://bitbucket.org/mirror/django/ | Python | 784 lines
                    
3from django.core.template import Node, NodeList, Template, Context, resolve_variable
                    
4from django.core.template import TemplateSyntaxError, VariableDoesNotExist, BLOCK_TAG_START, BLOCK_TAG_END, VARIABLE_TAG_START, VARIABLE_TAG_END
                    
5from django.core.template import get_library, Library, InvalidTemplateLibrary
                    
224            fp.close()
                    
225        except IOError:
                    
226            output = ''
                    
230                return t.render(context)
                    
231            except TemplateSyntaxError, e:
                    
232                if DEBUG:
                    
232                if DEBUG:
                    
233                    return "[Included template had syntax error: %s]" % e
                    
234                else:
                    
279            ratio = (value / maxvalue) * int(self.max_width)
                    
280        except (ValueError, ZeroDivisionError):
                    
281            return ''
                    
                
__init__.py https://bitbucket.org/mirror/django/ | Python | 914 lines
                    
31Create a compiled template object with a template_string, then call render()
                    
32with a context. In the compilation stage, the TemplateSyntaxError exception
                    
33will be raised if the template doesn't have proper syntax.
                    
91
                    
92class TemplateSyntaxError(Exception):
                    
93    pass
                    
116    def reload(self):
                    
117        raise NotImplementedError
                    
118
                    
294                    command = token.contents.split()[0]
                    
295                except IndexError:
                    
296                    self.empty_block_tag(token)
                    
300                    compile_func = self.tags[command]
                    
301                except KeyError:
                    
302                    self.invalid_block_tag(token, command)
                    
                
fields.py https://bitbucket.org/mirror/django/ | Python | 960 lines
                    
45    except ObjectDoesNotExist:
                    
46        raise validators.ValidationError, _("Please enter a valid %s.") % f.verbose_name
                    
47
                    
59        return
                    
60    raise validators.ValidationError, _("%(optname)s with this %(fieldname)s already exists.") % {'optname': capfirst(opts.verbose_name), 'fieldname': f.verbose_name}
                    
61
                    
193            return []
                    
194        raise TypeError, "Field has invalid lookup: %s" % lookup_type
                    
195
                    
                
__init__.py https://bitbucket.org/mirror/django/ | Python | 1976 lines
                    
90            _installed_models_cache.append(__import__(a + '.models', '', '', ['']))
                    
91        except ImportError:
                    
92            pass
                    
113                mod._MODELS
                    
114            except AttributeError:
                    
115                pass # Skip model modules that don't actually have models in them.
                    
156    def template_name(self):
                    
157        raise NotImplementedError
                    
158
                    
309        else:
                    
310            raise TypeError, other
                    
311
                    
317        else:
                    
318            raise TypeError, other
                    
319
                    
                
validators.py https://bitbucket.org/mirror/django/ | Python | 495 lines
                    
44        # instance would result in this:
                    
45        # AttributeError: ValidationError instance has no attribute 'args'
                    
46        # See http://www.python.org/doc/current/tut/node10.html#handling
                    
186    error_messages = [e.firstChild.wholeText for e in parseString(u.read()).getElementsByTagName('messages')[0].getElementsByTagName('msg')]
                    
187    raise ValidationError, _("Valid HTML is required. Specific errors are:\n%s") % "\n".join(error_messages)
                    
188
                    
301        if all_data.has_key(self.other_field) and all_data[self.other_field] != self.other_value and not field_data:
                    
302            raise ValidationError(self.error_message)
                    
303
                    
305    def __init__(self, other_field_name, error_message):
                    
306        self.other, self.error_message = other_field_name, error_message
                    
307
                    
309        if field_data > all_data[self.other]:
                    
310            raise ValidationError, self.error_message
                    
311
                    
                
cache.py https://bitbucket.org/mirror/django/ | Python | 503 lines
                    
83            timeout = int(timeout)
                    
84        except (ValueError, TypeError):
                    
85            timeout = 300
                    
331                return pickle.load(f)
                    
332        except (IOError, OSError, EOFError, pickle.PickleError):
                    
333            pass
                    
371                os.remove(os.path.join(self._dir, fname))
                    
372            except (IOError, OSError):
                    
373                pass
                    
399            self._max_entries = int(max_entries)
                    
400        except (ValueError, TypeError):
                    
401            self._max_entries = 300
                    
404            self._cull_frequency = int(cull_frequency)
                    
405        except (ValueError, TypeError):
                    
406            self._cull_frequency = 3
                    
                
formfields.py https://bitbucket.org/mirror/django/ | Python | 915 lines
                    
73                            errors.setdefault(field.field_name, []).extend(e.messages)
                    
74            # If a CriticalValidationError is raised, ignore any other ValidationErrors
                    
75            # for this particular field
                    
195            if hasattr(field, 'errors'):
                    
196                errors.extend(field.errors())
                    
197        return errors
                    
202    def html_combined_error_list(self):
                    
203        return ''.join([field.html_error_list() for field in self.formfield_dict.values() if hasattr(field, 'errors')])
                    
204
                    
210        self.data = data
                    
211        self.errors = errors
                    
212        self._collections = None
                    
249                            data = field.extract_data(self.data)
                    
250                            errors = self.errors.get(full_field_name, [])
                    
251                            collection[field_name] = FormFieldWrapper(field, data, errors)
                    
                
global.css https://bitbucket.org/mirror/django/ | CSS | 338 lines
                    
38div.system-message { background: #ffc; margin: 10px; padding: 6px 8px; font-size: .8em; }
                    
39div.system-message p.system-message-title { padding:4px 5px 4px 25px; margin:0; color:red;background:#ffc url(../img/admin/icon_error.gif) 5px .3em no-repeat; }
                    
40
                    
187
                    
188/* MESSAGES & ERRORS  */
                    
189ul.messagelist { padding:0 0 5px 0; margin:0; }
                    
190ul.messagelist li { font-size:12px; display:block; padding:4px 5px 4px 25px; margin:0 0 3px 0; border-bottom:1px solid #ddd; color:#666; background:#ffc url(../img/admin/icon_success.gif) 5px .3em no-repeat; }
                    
191.errornote { font-size:12px !important; display:block; padding:4px 5px 4px 25px; margin:0 0 3px 0; border:1px solid red; color:red;background:#ffc url(../img/admin/icon_error.gif) 5px .3em no-repeat; }
                    
192ul.errorlist { margin:0 !important; padding:0 !important; }
                    
192ul.errorlist { margin:0 !important; padding:0 !important; }
                    
193.errorlist li { font-size:12px !important; display:block; padding:4px 5px 4px 25px; margin:0 0 3px 0; border:1px solid red; color:white; background:red url(../img/admin/icon_alert.gif) 5px .3em no-repeat; }
                    
194td ul.errorlist { margin:0 !important; padding:0 !important; }
                    
196.error { background:#ffc; }
                    
197.error input, .error select { border:1px solid red; }
                    
198
                    
                
models.py https://bitbucket.org/mirror/django/ | Python | 401 lines
                    
12
                    
13from util import ValidationError, ErrorList
                    
14from forms import BaseForm, get_declared_fields
                    
33    opts = instance.__class__._meta
                    
34    if form.errors:
                    
35        raise ValueError("The %s could not be %s because the data didn't"
                    
220            parents = [b for b in bases if issubclass(b, ModelForm)]
                    
221        except NameError:
                    
222            # We are defining ModelForm itself.
                    
245    def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None,
                    
246                 initial=None, error_class=ErrorList, label_suffix=':',
                    
247                 instance=None):
                    
365        except self.queryset.model.DoesNotExist:
                    
366            raise ValidationError(self.error_messages['invalid_choice'])
                    
367        return value
                    
                
widgets.py https://bitbucket.org/mirror/django/ | Python | 482 lines
                    
6    set
                    
7except NameError:
                    
8    from sets import Set as set   # Python 2.3 fallback
                    
51        """
                    
52        raise NotImplementedError
                    
53
                    
238            value = {True: u'2', False: u'3', u'2': u'2', u'3': u'3'}[value]
                    
239        except KeyError:
                    
240            value = u'1'
                    
317    def __getitem__(self, idx):
                    
318        choice = self.choices[idx] # Let the IndexError propogate
                    
319        return RadioInput(self.name, self.value, self.attrs.copy(), choice, idx)
                    
                
related.py https://bitbucket.org/mirror/django/ | Python | 877 lines
                    
16    set
                    
17except NameError:
                    
18    from sets import Set as set   # Python 2.3 fallback
                    
58            app_label, model_name = relation.split(".")
                    
59        except ValueError:
                    
60            # If we can't split, assume a model in current app
                    
93    except klass.DoesNotExist:
                    
94        raise validators.ValidationError, _("Please enter a valid %s.") % f.verbose_name
                    
95
                    
140                    v = getattr(v, v._meta.pk.name)
                    
141            except AttributeError:
                    
142                pass
                    
153            return []
                    
154        raise TypeError, "Related Field has invalid lookup: %s" % lookup_type
                    
155
                    
                
__init__.py https://bitbucket.org/mirror/django/ | Python | 1191 lines
                    
6    import decimal
                    
7except ImportError:
                    
8    from django.utils import _decimal as decimal    # for Python 2.3
                    
52        return
                    
53    raise validators.ValidationError, _("%(optname)s with this %(fieldname)s already exists.") % {'optname': capfirst(opts.verbose_name), 'fieldname': f.verbose_name}
                    
54
                    
140        Converts the input value into the expected Python data type, raising
                    
141        validators.ValidationError if the data can't be converted. Returns the
                    
142        converted value. Subclasses should override this.
                    
168            return get_creation_module().DATA_TYPES[self.get_internal_type()] % data
                    
169        except KeyError:
                    
170            return None
                    
191        """
                    
192        Raises validators.ValidationError if field_data has any errors.
                    
193        Subclasses should override this to specify field-specific validation
                    
                
manipulators.py https://bitbucket.org/mirror/django/ | Python | 339 lines
                    
31        if instance != None:
                    
32            raise AttributeError, "Manipulator cannot be accessed via instance"
                    
33        else:
                    
                
options.py https://bitbucket.org/mirror/django/ | Python | 562 lines
                    
4    set
                    
5except NameError:
                    
6    from sets import Set as set     # Python 2.3 fallback
                    
88            if meta_attrs != {}:
                    
89                raise TypeError, "'class Meta' got invalid attribute(s): %s" % ','.join(meta_attrs.keys())
                    
90        else:
                    
127                collections[target].add(column)
                    
128            except KeyError:
                    
129                collections[target] = set([column])
                    
189            self._field_name_cache
                    
190        except AttributeError:
                    
191            self._fill_fields_cache()
                    
202            self._field_cache
                    
203        except AttributeError:
                    
204            self._fill_fields_cache()
                    
                
base.py https://bitbucket.org/mirror/django/ | Python | 615 lines
                    
7    set
                    
8except NameError:
                    
9    from sets import Set as set     # Python 2.3 fallback.
                    
13from django.core import validators
                    
14from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned, FieldError
                    
15from django.db.models.fields import AutoField, ImageField, FieldDoesNotExist
                    
115                    if field.name in names:
                    
116                        raise FieldError('Local field %r in class %r clashes with field of similar name from abstract base class %r'
                    
117                                % (field.name, name, base.__name__))
                    
183            # Daft, but matches old exception sans the err msg.
                    
184            raise IndexError("Number of args exceeds number of fields")
                    
185
                    
211                        rel_obj = kwargs.pop(field.name)
                    
212                    except KeyError:
                    
213                        try:
                    
                
models.py https://bitbucket.org/mirror/django/ | Python | 389 lines
                    
15    set
                    
16except NameError:
                    
17    from sets import Set as set   # Python 2.3 fallback
                    
27            import crypt
                    
28        except ImportError:
                    
29            raise ValueError('"crypt" password algorithm not supported in this environment')
                    
34        import hashlib
                    
35    except ImportError:
                    
36        if algorithm == 'md5':
                    
46            return hashlib.sha1(salt + raw_password).hexdigest()
                    
47    raise ValueError("Got unknown password algorithm type in password.")
                    
48
                    
308                self._profile_cache = model._default_manager.get(user__id__exact=self.id)
                    
309            except (ImportError, ImproperlyConfigured):
                    
310                raise SiteProfileNotAvailable
                    
                
main.py https://bitbucket.org/mirror/django/ | Python | 777 lines
                    
133        if max([bool(f.errors()) for f in self.form_fields]):
                    
134            classes.append('error')
                    
135        if classes:
                    
150            return self._display
                    
151        except AttributeError:
                    
152            if isinstance(self.field.rel, models.ManyToOneRel):
                    
161    def html_error_list(self):
                    
162        return mark_safe(" ".join([form_field.html_error_list() for form_field in self.form_fields if form_field.errors]))
                    
163
                    
259
                    
260        errors = manipulator.get_validation_errors(new_data)
                    
261        manipulator.do_html2python(new_data)
                    
333
                    
334        errors = manipulator.get_validation_errors(new_data)
                    
335        manipulator.do_html2python(new_data)
                    
                
forms.py https://bitbucket.org/mirror/django/ | Python | 1671 lines
                    
37u''
                    
38>>> p.errors.as_text()
                    
39u''
                    
71True
                    
72>>> p.errors['first_name']
                    
73[u'This field is required.']
                    
82...
                    
83AttributeError: 'Person' object has no attribute 'cleaned_data'
                    
84>>> print p
                    
93<li><ul class="errorlist"><li>This field is required.</li></ul><label for="id_first_name">First name:</label> <input type="text" name="first_name" id="id_first_name" /></li>
                    
94<li><ul class="errorlist"><li>This field is required.</li></ul><label for="id_last_name">Last name:</label> <input type="text" name="last_name" id="id_last_name" /></li>
                    
95<li><ul class="errorlist"><li>This field is required.</li></ul><label for="id_birthday">Birthday:</label> <input type="text" name="birthday" id="id_birthday" /></li>
                    
151>>> p.errors.as_ul()
                    
152u'<ul class="errorlist"><li>first_name<ul class="errorlist"><li>This field is required.</li></ul></li><li>birthday<ul class="errorlist"><li>This field is required.</li></ul></li></ul>'
                    
153>>> print p.errors.as_text()
                    
                
models.py https://bitbucket.org/mirror/django/ | Python | 996 lines
                    
74        image = models.ImageField(upload_to=tempfile.gettempdir())
                    
75    except ImportError:
                    
76        image = models.FileField(upload_to=tempfile.gettempdir())
                    
291
                    
292If you call save() with invalid data, you'll get a ValueError.
                    
293>>> f = CategoryForm({'name': '', 'slug': '', 'url': 'foo'})
                    
293>>> f = CategoryForm({'name': '', 'slug': '', 'url': 'foo'})
                    
294>>> f.errors['name']
                    
295[u'This field is required.']
                    
295[u'This field is required.']
                    
296>>> f.errors['slug']
                    
297[u'This field is required.']
                    
300...
                    
301AttributeError: 'CategoryForm' object has no attribute 'cleaned_data'
                    
302>>> f.save()
                    
                
query.py https://bitbucket.org/mirror/django/ | Python | 865 lines
                    
2    set
                    
3except NameError:
                    
4    from sets import Set as set     # Python 2.3 fallback
                    
5
                    
6from django.db import connection, transaction, IntegrityError
                    
7from django.db.models.fields import DateField
                    
23    """
                    
24    An error when dealing with a collection of objects that have a cyclic
                    
25    dependency, i.e. when deleting multiple objects.
                    
191        if not isinstance(k, (slice, int, long)):
                    
192            raise TypeError
                    
193        assert ((not isinstance(k, slice) and (k >= 0))
                    
230        except self.model.DoesNotExist, e:
                    
231            raise IndexError, e.args
                    
232
                    
                
fields.py https://bitbucket.org/mirror/django/ | Python | 827 lines
                    
182        if self.max_value is not None and value > self.max_value:
                    
183            raise ValidationError(self.error_messages['max_value'] % self.max_value)
                    
184        if self.min_value is not None and value < self.min_value:
                    
213        if self.min_value is not None and value < self.min_value:
                    
214            raise ValidationError(self.error_messages['min_value'] % self.min_value)
                    
215        return value
                    
252        if self.min_value is not None and value < self.min_value:
                    
253            raise ValidationError(self.error_messages['min_value'] % self.min_value)
                    
254        if self.max_digits is not None and (digits + decimals) > self.max_digits:
                    
295                continue
                    
296        raise ValidationError(self.error_messages['invalid'])
                    
297
                    
326                continue
                    
327        raise ValidationError(self.error_messages['invalid'])
                    
328
                    
                
options.py https://bitbucket.org/mirror/django/ | Python | 908 lines
                    
18    set
                    
19except NameError:
                    
20    from sets import Set as set     # Python 2.3 fallback
                    
93
                    
94    def errors(self):
                    
95        return mark_safe(u'\n'.join([self.form[f].errors.as_ul() for f in self.fields]).strip('\n'))
                    
                
tests.py https://bitbucket.org/mirror/django/ | Python | 551 lines
                    
219        # Login.context is a list of context dicts we just need to check the first one.
                    
220        self.assert_(login.context[0].get('error_message'))
                    
221
                    
                
tests.py https://bitbucket.org/mirror/django/ | Python | 1086 lines
                    
54                os.remove(full_name + 'c')
                    
55        except OSError:
                    
56            pass
                    
112            stdin, stdout, stderr = (p.stdin, p.stdout, p.stderr)
                    
113        except ImportError:
                    
114            stdin, stdout, stderr = os.popen3(cmd)
                    
163    def test_builtin_command(self):
                    
164        "no settings: django-admin builtin commands fail with an import error when no settings provided"
                    
165        args = ['sqlall','admin_scripts']
                    
195    def test_builtin_command(self):
                    
196        "default: django-admin builtin commands fail with an import error when no settings provided"
                    
197        args = ['sqlall','admin_scripts']
                    
261    def test_builtin_command(self):
                    
262        "fulldefault: django-admin builtin commands fail with an import error when no settings provided"
                    
263        args = ['sqlall','admin_scripts']
                    
                
__init__.py https://bitbucket.org/mirror/django/ | Python | 456 lines
                    
2import re
                    
3from Cookie import SimpleCookie, CookieError
                    
4from pprint import pformat
                    
9    from mod_python.util import parse_qsl
                    
10except ImportError:
                    
11    from cgi import parse_qsl
                    
105        if hasattr(self, '_files'):
                    
106            raise AttributeError("You cannot set the upload handlers after the upload has been processed.")
                    
107        self._upload_handlers = upload_handlers
                    
147        for key, value in parse_qsl((query_string or ''), True): # keep_blank_values=True
                    
148            self.appendlist(force_unicode(key, encoding, errors='replace'),
                    
149                            force_unicode(value, encoding, errors='replace'))
                    
166        if not self._mutable:
                    
167            raise AttributeError("This QueryDict instance is immutable")
                    
168
                    
                
validation.py https://bitbucket.org/mirror/django/ | Python | 222 lines
                    
4
                    
5class ModelErrorCollection:
                    
6    def __init__(self, outfile=sys.stdout):
                    
11    def add(self, context, error):
                    
12        self.errors.append((context, error))
                    
13        self.outfile.write(self.style.ERROR("%s: %s\n" % (context, error)))
                    
14
                    
15def get_validation_errors(outfile, app=None):
                    
16    """
                    
17    Validates all models that are part of the specified app. If no app name is provided,
                    
18    validates all models of all installed apps. Writes errors, if any, to outfile.
                    
19    Returns number of errors.
                    
27
                    
28    for (app_name, error) in get_app_errors().items():
                    
29        e.add(app_name, error)
                    
                
debug.py https://bitbucket.org/mirror/django/ | Python | 803 lines
                    
74                        for t in source_list_func(str(self.exc_value))]
                    
75                except (ImportError, AttributeError):
                    
76                    template_list = []
                    
86        unicode_hint = ''
                    
87        if issubclass(self.exc_type, UnicodeError):
                    
88            start = getattr(self.exc_value, 'start', None)
                    
96            'exception_type': self.exc_type.__name__,
                    
97            'exception_value': smart_unicode(self.exc_value, errors='replace'),
                    
98            'unicode_hint': unicode_hint,
                    
165                    f.close()
                    
166            except (OSError, IOError):
                    
167                pass
                    
246        tried = exception.args[0]['tried']
                    
247    except (IndexError, TypeError):
                    
248        tried = []
                    
                
query.py https://bitbucket.org/mirror/django/ | Python | 1722 lines
                    
20from django.db.models.sql.datastructures import Count
                    
21from django.core.exceptions import FieldError
                    
22from datastructures import EmptyResultSet, Empty, MultiJoin
                    
26    set
                    
27except NameError:
                    
28    from sets import Set as set     # Python 2.3 fallback
                    
385            if self.extra_select and rhs.extra_select:
                    
386                raise ValueError("When merging querysets using 'or', you "
                    
387                        "cannot have extra(select=...) on both sides.")
                    
388            if self.extra_where and rhs.extra_where:
                    
389                raise ValueError("When merging querysets using 'or', you "
                    
390                        "cannot have extra(where=...) on both sides.")
                    
                
subqueries.py https://bitbucket.org/mirror/django/ | Python | 412 lines
                    
4
                    
5from django.core.exceptions import FieldError
                    
6from django.db.models.sql.constants import *
                    
230            if not direct or m2m:
                    
231                raise FieldError('Cannot update model field %r (only non-relations and foreign keys permitted).' % field)
                    
232            values_seq.append((field, model, val))
                    
265            self.related_updates[model].append((column, value, placeholder))
                    
266        except KeyError:
                    
267            self.related_updates[model] = [(column, value, placeholder)]
                    
                
related.py https://bitbucket.org/mirror/django/ | Python | 899 lines
                    
14    set
                    
15except NameError:
                    
16    from sets import Set as set   # Python 2.3 fallback
                    
55            app_label, model_name = relation.split(".")
                    
56        except ValueError:
                    
57            # If we can't split, assume a model in current app
                    
131                    v = getattr(v, v._meta.pk.name)
                    
132            except AttributeError:
                    
133                pass
                    
144            return []
                    
145        raise TypeError, "Related Field has invalid lookup: %s" % lookup_type
                    
146
                    
165        if instance is None:
                    
166            raise AttributeError, "%s must be accessed via instance" % self.related.opts.object_name
                    
167
                    
                
base.py https://bitbucket.org/mirror/django/ | Python | 501 lines
                    
7    set
                    
8except NameError:
                    
9    from sets import Set as set     # Python 2.3 fallback.
                    
11import django.db.models.manager     # Imported to register signal handler.
                    
12from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned, FieldError
                    
13from django.db.models.fields import AutoField
                    
16from django.db.models.options import Options
                    
17from django.db import connection, transaction, DatabaseError
                    
18from django.db.models import signals
                    
111                    if field.name in names:
                    
112                        raise FieldError('Local field %r in class %r clashes with field of similar name from abstract base class %r'
                    
113                                % (field.name, name, base.__name__))
                    
176            # Daft, but matches old exception sans the err msg.
                    
177            raise IndexError("Number of args exceeds number of fields")
                    
178
                    
                
base.py https://bitbucket.org/mirror/django/ | Python | 438 lines
                    
14    import cx_Oracle as Database
                    
15except ImportError, e:
                    
16    from django.core.exceptions import ImproperlyConfigured
                    
16    from django.core.exceptions import ImproperlyConfigured
                    
17    raise ImproperlyConfigured("Error loading cx_Oracle module: %s" % e)
                    
18
                    
25
                    
26DatabaseError = Database.Error
                    
27IntegrityError = Database.IntegrityError
                    
124    def regex_lookup_9(self, lookup_type):
                    
125        raise NotImplementedError("Regexes are not supported in Oracle before version 10g.")
                    
126
                    
265                    self.ops.regex_lookup = self.ops.regex_lookup_10
                    
266            except ValueError:
                    
267                pass
                    
                
models.py https://bitbucket.org/mirror/django/ | Python | 559 lines
                    
9
                    
10from util import ValidationError, ErrorList
                    
11from forms import BaseForm, get_declared_fields
                    
32    opts = instance._meta
                    
33    if form.errors:
                    
34        raise ValueError("The %s could not be %s because the data didn't"
                    
162            parents = [b for b in bases if issubclass(b, ModelForm)]
                    
163        except NameError:
                    
164            # We are defining ModelForm itself.
                    
189    def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None,
                    
190                 initial=None, error_class=ErrorList, label_suffix=':',
                    
191                 empty_permitted=False, instance=None):
                    
203        super(BaseModelForm, self).__init__(data, files, auto_id, prefix, object_data,
                    
204                                            error_class, label_suffix, empty_permitted)
                    
205
                    
                
widgets.py https://bitbucket.org/mirror/django/ | Python | 665 lines
                    
6    set
                    
7except NameError:
                    
8    from sets import Set as set   # Python 2.3 fallback
                    
47        # if media_attrs != {}:
                    
48        #     raise TypeError, "'class Media' has invalid attribute(s): %s" % ','.join(media_attrs.keys())
                    
49
                    
77            return Media(**{name: getattr(self, '_' + name)})
                    
78        raise KeyError('Unknown media type "%s"' % name)
                    
79
                    
154        """
                    
155        raise NotImplementedError
                    
156
                    
395            value = {True: u'2', False: u'3', u'2': u'2', u'3': u'3'}[value]
                    
396        except KeyError:
                    
397            value = u'1'
                    
                
generic.py https://bitbucket.org/mirror/django/ | Python | 388 lines
                    
27        # Make sure the fields exist (these raise FieldDoesNotExist,
                    
28        # which is a fine error to raise here)
                    
29        self.name = name
                    
62        if instance is None:
                    
63            raise AttributeError, u"%s must be accessed via instance" % self.name
                    
64
                    
66            return getattr(instance, self.cache_attr)
                    
67        except AttributeError:
                    
68            rel_obj = None
                    
86        if instance is None:
                    
87            raise AttributeError, u"%s must be accessed via instance" % self.related.opts.object_name
                    
88
                    
183        if instance is None:
                    
184            raise AttributeError, "Manager must be accessed via instance"
                    
185
                    
                
sites.py https://bitbucket.org/mirror/django/ | Python | 418 lines
                    
17
                    
18ERROR_MESSAGE = ugettext_lazy("Please enter a correct username and password. Note that both fields are case-sensitive.")
                    
19LOGIN_FORM_KEY = 'this_is_the_login_form'
                    
189            admin_obj = self._registry[model]
                    
190        except KeyError:
                    
191            raise http.Http404("This model exists but has not been registered with the admin site.")
                    
258        if user is None:
                    
259            message = ERROR_MESSAGE
                    
260            if u'@' in username:
                    
287            else:
                    
288                return self.display_login_form(request, ERROR_MESSAGE)
                    
289    login = never_cache(login)
                    
345
                    
346    def display_login_form(self, request, error_message='', extra_context=None):
                    
347        request.session.set_test_cookie()
                    
                
models.py https://bitbucket.org/mirror/django/ | Python | 892 lines
                    
94If we specify fields or fieldsets, it should exclude fields on the Form class
                    
95to the fields specified. This may cause errors to be raised in the db layer if
                    
96required model fields arent in fields/fieldsets, but that's preferable to
                    
96required model fields arent in fields/fieldsets, but that's preferable to
                    
97ghost errors where you have a field in your Form class that isn't being
                    
98displayed because you forgot to add it to fields/fielsets
                    
                
tests.py https://bitbucket.org/mirror/django/ | Python | 955 lines
                    
25    from loaders import *
                    
26except ImportError:
                    
27    pass # If setuptools isn't installed, that's fine. Just move on.
                    
148                return (template_tests[template_name][0] , "test:%s" % template_name)
                    
149            except KeyError:
                    
150                raise template.TemplateDoesNotExist, template_name
                    
232            # A variable may not contain more than one word
                    
233            'basic-syntax06': ("{{ multi word variable }}", {}, template.TemplateSyntaxError),
                    
234
                    
234
                    
235            # Raise TemplateSyntaxError for empty variable tags
                    
236            'basic-syntax07': ("{{ }}",        {}, template.TemplateSyntaxError),
                    
236            'basic-syntax07': ("{{ }}",        {}, template.TemplateSyntaxError),
                    
237            'basic-syntax08': ("{{        }}", {}, template.TemplateSyntaxError),
                    
238
                    
                
widgets.py https://bitbucket.org/mirror/django/ | Python | 1118 lines
                    
10...     from decimal import Decimal
                    
11... except ImportError:
                    
12...     from django.utils._decimal import Decimal
                    
186FileInput widgets don't ever show the value, because the old value is of no use
                    
187if you are updating the form or if the provided file generated an error.
                    
188>>> w = FileInput()
                    
                
models.py https://bitbucket.org/mirror/django/ | Python | 1054 lines
                    
18    sorted
                    
19except NameError:
                    
20    from django.utils.itercompat import sorted
                    
94        image = models.ImageField(storage=temp_storage, upload_to='tests')
                    
95    except ImportError:
                    
96        image = models.FileField(storage=temp_storage, upload_to='tests')
                    
311
                    
312If you call save() with invalid data, you'll get a ValueError.
                    
313>>> f = CategoryForm({'name': '', 'slug': 'not a slug!', 'url': 'foo'})
                    
313>>> f = CategoryForm({'name': '', 'slug': 'not a slug!', 'url': 'foo'})
                    
314>>> f.errors['name']
                    
315[u'This field is required.']
                    
315[u'This field is required.']
                    
316>>> f.errors['slug']
                    
317[u"Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens."]
                    
                
validators.py https://bitbucket.org/mirror/django/ | Python | 421 lines
                    
37        # instance would result in this:
                    
38        # AttributeError: ValidationError instance has no attribute 'args'
                    
39        # See http://www.python.org/doc/current/tut/node10.html#handling
                    
175        raise ValidationError, "Invalid URL: %s" % field_data
                    
176    except: # urllib2.HTTPError, urllib2.URLError, httplib.InvalidURL, etc.
                    
177        raise ValidationError, "The URL %s is a broken link." % field_data
                    
327        self.min_error_message = min_error_message or "Make sure your uploaded file is at least %s bytes big." % min_size
                    
328        self.max_error_message = max_error_message or "Make sure your uploaded file is at most %s bytes big." % min_size
                    
329
                    
331        if self.min_size is not None and len(field_data['content']) < self.min_size:
                    
332            raise ValidationError, self.min_error_message
                    
333        if self.max_size is not None and len(field_data['content']) > self.max_size:
                    
333        if self.max_size is not None and len(field_data['content']) > self.max_size:
                    
334            raise ValidationError, self.max_error_message
                    
335
                    
                
template.py https://bitbucket.org/mirror/django/ | Python | 489 lines
                    
266        if self.current != FILTER_SEPARATOR:
                    
267            raise TemplateSyntaxError, "Bad character (expecting '%s') '%s'" % (FILTER_SEPARATOR, self.current)
                    
268        # We have a filter separator; start reading the filters
                    
294            if not registered_filters.has_key(filter_name):
                    
295                raise TemplateSyntaxError, "Invalid filter: '%s'" % filter_name
                    
296            if registered_filters[filter_name][1] == True and arg is None:
                    
377            current = current[bits[0]]
                    
378        except (TypeError, AttributeError, KeyError):
                    
379            try: # attribute lookup
                    
390                            current = '' # invalid method call
                    
391            except (TypeError, AttributeError):
                    
392                try: # list-index lookup
                    
393                    current = current[int(bits[0])]
                    
394                except (IndexError, ValueError, KeyError):
                    
395                    raise VariableDoesNotExist, "Failed lookup for key [%s] in %r" % (bits[0], current) # missing attribute
                    
                
meta.py https://bitbucket.org/mirror/django/ | Python | 2143 lines
                    
78            _installed_models_cache.append(__import__(a + '.models', '', '', ['']))
                    
79        except ImportError:
                    
80            pass
                    
237        """
                    
238        Returns the requested field by name. Raises FieldDoesNotExist on error.
                    
239        """
                    
283            return self._all_related_objects
                    
284        except AttributeError:
                    
285            module_list = get_installed_model_modules()
                    
                
formfields.py https://bitbucket.org/mirror/django/ | Python | 760 lines
                    
72                            errors.setdefault(field.field_name, []).extend(e.messages)
                    
73            # If a CriticalValidationError is raised, ignore any other ValidationErrors
                    
74            # for this particular field
                    
109        self.manipulator, self.data = manipulator, data
                    
110        self.error_dict = error_dict
                    
111
                    
132    def __init__(self, formfield, data, error_list):
                    
133        self.formfield, self.data, self.error_list = formfield, data, error_list
                    
134        self.field_name = self.formfield.field_name # for convenience in templates
                    
154        if self.errors():
                    
155            return '<ul class="errorlist"><li>%s</li></ul>' % '</li><li>'.join([escape(e) for e in self.errors()])
                    
156        else:
                    
177        for field in self.formfield_dict.values():
                    
178            errors.extend(field.errors())
                    
179        return errors
                    
                
main.py https://bitbucket.org/mirror/django/ | Python | 1090 lines
                    
18        mod = meta.get_module(app_label, module_name)
                    
19    except ImportError:
                    
20        raise Http404 # Invalid app or module name. Maybe it's not in INSTALLED_APPS.
                    
92        page_num = int(request.GET.get(PAGE_VAR, 0))
                    
93    except ValueError:
                    
94        page_num = 0
                    
116                    order_field = f.name
                    
117        except (IndexError, ValueError):
                    
118            pass # Invalid ordering specified. Just use the default.
                    
163    # values are not in the correct type (which would result in a database
                    
164    # error).
                    
165    except:
                    
                
template_tests.py https://bitbucket.org/mirror/django/ | Python | 708 lines
                    
16
                    
17class RandomSyntaxErrorsCheck(unittest.TestCase):
                    
18
                    
60        t = '<h1>{{multi word tag}}</h1>'
                    
61        self.assertRaises(template.TemplateSyntaxError, template.Template, t)
                    
62
                    
63    def testEmptyTag(self):
                    
64        "Raise TemplateSyntaxError for empty variable tags"
                    
65        t = '{{ }}'
                    
65        t = '{{ }}'
                    
66        self.assertRaises(template.TemplateSyntaxError, template.Template, t)
                    
67        t = '{{              }}'
                    
67        t = '{{              }}'
                    
68        self.assertRaises(template.TemplateSyntaxError, template.Template, t)
                    
69
                    
                
base.py https://bitbucket.org/mirror/django/ | Python | 523 lines
                    
7    set
                    
8except NameError:
                    
9    from sets import Set as set     # Python 2.3 fallback.
                    
11import django.db.models.manager     # Imported to register signal handler.
                    
12from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned, FieldError
                    
13from django.db.models.fields import AutoField
                    
16from django.db.models.options import Options
                    
17from django.db import connection, transaction, DatabaseError
                    
18from django.db.models import signals
                    
115                    if field.name in field_names:
                    
116                        raise FieldError('Local field %r in class %r clashes '\
                    
117                                         'with field of similar name from '\
                    
133                if base._meta.abstract and field.name in field_names:
                    
134                    raise FieldError('Local field %r in class %r clashes '\
                    
135                                     'with field of similar name from '\
                    
                
models.py https://bitbucket.org/mirror/django/ | Python | 682 lines
                    
10
                    
11from util import ValidationError, ErrorList
                    
12from forms import BaseForm, get_declared_fields
                    
191    def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None,
                    
192                 initial=None, error_class=ErrorList, label_suffix=':',
                    
193                 empty_permitted=False, instance=None):
                    
239        # Don't run unique checks on fields that already have an error.
                    
240        unique_checks = [check for check in unique_checks if not [x in self._errors for x in check if x in self._errors]]
                    
241        
                    
266                    # Insert the error into the error dict, very sneaky
                    
267                    self._errors[field_name] = ErrorList([
                    
268                        _(u"%(model_name)s with this %(field_label)s already exists.") % \
                    
287            # Raise the unique together errors since they are considered form-wide.
                    
288            raise ValidationError(form_errors)
                    
289
                    
                
sql.py https://bitbucket.org/mirror/django/ | Python | 498 lines
                    
1from django.core.management.base import CommandError
                    
2import os
                    
6    set
                    
7except NameError:
                    
8    from sets import Set as set   # Python 2.3 fallback
                    
73        # hasn't set DATABASE_ENGINE.
                    
74        raise CommandError("Django doesn't know which syntax to use for your SQL statements,\n" +
                    
75            "because you haven't specified the DATABASE_ENGINE setting.\n" +
                    
                
base.py https://bitbucket.org/mirror/django/ | Python | 551 lines
                    
8    set
                    
9except NameError:
                    
10    from sets import Set as set     # Python 2.3 fallback.
                    
14from django.core import validators
                    
15from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned, FieldError
                    
16from django.db.models.fields import AutoField
                    
114                    if field.name in names:
                    
115                        raise FieldError('Local field %r in class %r clashes with field of similar name from abstract base class %r'
                    
116                                % (field.name, name, base.__name__))
                    
179            # Daft, but matches old exception sans the err msg.
                    
180            raise IndexError("Number of args exceeds number of fields")
                    
181
                    
208                        rel_obj = kwargs.pop(field.name)
                    
209                    except KeyError:
                    
210                        try:
                    
                
tests.py https://bitbucket.org/mirror/django/ | Python | 1081 lines
                    
54                os.remove(full_name + 'c')
                    
55        except OSError:
                    
56            pass
                    
158    def test_builtin_command(self):
                    
159        "no settings: django-admin builtin commands fail with an import error when no settings provided"
                    
160        args = ['sqlall','admin_scripts']
                    
190    def test_builtin_command(self):
                    
191        "default: django-admin builtin commands fail with an import error when no settings provided"
                    
192        args = ['sqlall','admin_scripts']
                    
256    def test_builtin_command(self):
                    
257        "fulldefault: django-admin builtin commands fail with an import error when no settings provided"
                    
258        args = ['sqlall','admin_scripts']
                    
267        self.assertNoOutput(out)
                    
268        self.assertOutput(err, 'ImportError: No module named regressiontests')
                    
269
                    
                
models.py https://bitbucket.org/mirror/django/ | Python | 1021 lines
                    
79        image = models.ImageField(storage=temp_storage, upload_to='tests')
                    
80    except ImportError:
                    
81        image = models.FileField(storage=temp_storage, upload_to='tests')
                    
296
                    
297If you call save() with invalid data, you'll get a ValueError.
                    
298>>> f = CategoryForm({'name': '', 'slug': '', 'url': 'foo'})
                    
298>>> f = CategoryForm({'name': '', 'slug': '', 'url': 'foo'})
                    
299>>> f.errors['name']
                    
300[u'This field is required.']
                    
300[u'This field is required.']
                    
301>>> f.errors['slug']
                    
302[u'This field is required.']
                    
305...
                    
306AttributeError: 'CategoryForm' object has no attribute 'cleaned_data'
                    
307>>> f.save()
                    
                
fields.py https://bitbucket.org/mirror/django/ | Python | 829 lines
                    
27
                    
28from util import ErrorList, ValidationError
                    
29from widgets import TextInput, PasswordInput, HiddenInput, MultipleHiddenInput, FileInput, CheckboxInput, Select, NullBooleanSelect, SelectMultiple, DateTimeInput
                    
241        except DecimalException:
                    
242            raise ValidationError(self.error_messages['invalid'])
                    
243        pieces = str(value).lstrip("-").split('.')
                    
248        if self.min_value is not None and value < self.min_value:
                    
249            raise ValidationError(self.error_messages['min_value'] % self.min_value)
                    
250        if self.max_digits is not None and (digits + decimals) > self.max_digits:
                    
291                continue
                    
292        raise ValidationError(self.error_messages['invalid'])
                    
293
                    
322                continue
                    
323        raise ValidationError(self.error_messages['invalid'])
                    
324
                    
362            if len(value) != 2:
                    
363                raise ValidationError(self.error_messages['invalid
                    
                
options.py https://bitbucket.org/mirror/django/ | Python | 796 lines
                    
91
                    
92    def errors(self):
                    
93        return mark_safe(u'\n'.join([self.form[f].errors.as_ul() for f in self.fields]))
                    
                
fields.py https://bitbucket.org/mirror/django/ | Python | 1292 lines
                    
10...     from decimal import Decimal
                    
11... except ImportError:
                    
12...     from django.utils._decimal import Decimal
                    
19Each Field class does some sort of validation. Each Field has a clean() method,
                    
20which either raises django.forms.ValidationError or returns the "clean"
                    
21data -- usually a Unicode object, but, in some rare cases, a list.
                    
48...
                    
49ValidationError: [u'This field is required.']
                    
50>>> f.clean('')
                    
52...
                    
53ValidationError: [u'This field is required.']
                    
54>>> f.clean([1, 2, 3])
                    
77...
                    
78ValidationError: [u'Ensure this value has at most 10 characters (it has 11).']
                    
79
                    
                
formsets.py https://bitbucket.org/mirror/django/ | Python | 576 lines
                    
7
                    
8>>> from django.forms import Form, CharField, IntegerField, ValidationError
                    
9>>> from django.forms.formsets import formset_factory, BaseFormSet
                    
42We treat FormSet pretty much like we would treat a normal Form. FormSet has an
                    
43is_valid method, and a cleaned_data or errors attribute depending on whether all
                    
44the forms passed validation. However, unlike a Form instance, cleaned_data and
                    
44the forms passed validation. However, unlike a Form instance, cleaned_data and
                    
45errors will be a list of dicts rather than just a single dict.
                    
46
                    
57
                    
58FormSet instances can also have an error attribute if validation failed for
                    
59any of the forms.
                    
71False
                    
72>>> formset.errors
                    
73[{'votes': [u'This field is required.']}]
                    
                
lldir.cpp https://bitbucket.org/Chalice/nacl/ | C++ | 728 lines
                    
38
                    
39#include "llerror.h"
                    
40#include "lltimer.h"	// ms_sleep()
                    
109				result = errno;
                    
110				llwarns << "Problem removing " << fullpath << " - errorcode: "
                    
111						<< result << " attempt " << retry_count << llendl;
                    
                
CMakeLists.txt https://bitbucket.org/Chalice/nacl/ | CMake | 2104 lines
                    
135    lldebugview.cpp
                    
136    lldelayedgestureerror.cpp
                    
137    lldirpicker.cpp
                    
                
llappviewer.cpp https://bitbucket.org/Chalice/nacl/ | C++ | 5267 lines
                    
36#include "lltexteditor.h"
                    
37#include "llerrorcontrol.h"
                    
38#include "lleventtimer.h"
                    
311BOOL gCrashOnStartup = FALSE;
                    
312BOOL gLLErrorActivated = FALSE;
                    
313BOOL gLogoutInProgress = FALSE;
                    
319const std::string MARKER_FILE_NAME("SecondLife.exec_marker");
                    
320const std::string ERROR_MARKER_FILE_NAME("SecondLife.error_marker");
                    
321const std::string LLERROR_MARKER_FILE_NAME("SecondLife.llerror_marker");
                    
                
llappviewerwin32.cpp https://bitbucket.org/Chalice/nacl/ | C++ | 579 lines
                    
87	hMutex = CreateMutex(NULL, TRUE, unique_mutex_name); 
                    
88	if(GetLastError() == ERROR_ALREADY_EXISTS) 
                    
89	{     
                    
130		else
                    
131			heap_enable_lfh_error[i] = GetLastError();
                    
132	}
                    
160			{
                    
161				llinfos << "  Failed to enable LFH for heap: " << i << " Error: " << heap_enable_lfh_error[i] << llendl;
                    
162			}
                    
175		// We don't want to do cleanup here if the error handler got called -
                    
176		// the assumption is that the error handler is responsible for doing
                    
177		// app cleanup if there was a problem.
                    
264					U32 error_code = GetLastError();
                    
265					llinfos << "AddERExcludedApplication() failed with error code " << error_code << llendl;
                    
266				}
                    
                
 

Source

Language