Added assertion to WSF_UPLOADED_FILE
This commit is contained in:
@@ -173,7 +173,9 @@ feature -- Basic operation
|
|||||||
|
|
||||||
move_to (a_destination: STRING): BOOLEAN
|
move_to (a_destination: STRING): BOOLEAN
|
||||||
-- Move current uploaded file to `a_destination'
|
-- Move current uploaded file to `a_destination'
|
||||||
|
--| Violates CQS principle.
|
||||||
require
|
require
|
||||||
|
a_destination_not_empty: not a_destination.is_empty
|
||||||
has_no_error: not has_error
|
has_no_error: not has_error
|
||||||
local
|
local
|
||||||
f: RAW_FILE
|
f: RAW_FILE
|
||||||
@@ -182,9 +184,12 @@ feature -- Basic operation
|
|||||||
create f.make (n)
|
create f.make (n)
|
||||||
if f.exists then
|
if f.exists then
|
||||||
f.change_name (a_destination)
|
f.change_name (a_destination)
|
||||||
|
set_tmp_name (f.name)
|
||||||
Result := True
|
Result := True
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
ensure
|
||||||
|
exists: old exists implies exists
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Status
|
feature -- Status
|
||||||
@@ -199,6 +204,16 @@ feature -- Status
|
|||||||
-- Eventual error code
|
-- Eventual error code
|
||||||
--| no error => 0
|
--| no error => 0
|
||||||
|
|
||||||
|
exists: BOOLEAN
|
||||||
|
local
|
||||||
|
f: PLAIN_TEXT_FILE
|
||||||
|
do
|
||||||
|
if attached tmp_name as n then
|
||||||
|
create f.make (n)
|
||||||
|
Result := f.exists
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Element change
|
feature -- Element change
|
||||||
|
|
||||||
set_error (e: like error)
|
set_error (e: like error)
|
||||||
@@ -220,7 +235,7 @@ feature -- Element change
|
|||||||
end
|
end
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
|
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
source: "[
|
source: "[
|
||||||
Eiffel Software
|
Eiffel Software
|
||||||
|
|||||||
Reference in New Issue
Block a user