爲了避免在開發過程中反覆訪問SOAP服務器,我試圖緩存結果,以便我可以在不查詢服務器的情況下運行我的代碼的其餘部分。 在下面的代碼中,當我嘗試泡泡沫結果時,我得到一個PicklingError: Can't pickle <class suds.sudsobject.AdvertiserSearchResponse at 0x03424060>: it's not found as suds.su
我有以下型號: class User < ActiveRecord::Base
has_one :profile, :dependent => :destroy
def before_create
self.profile ||= Profile.new
end
end
class Profile < ActiveRecord::Base
當如何定義某一類對象應該通過__setstate__被拆封,我推測,它是安全的 def __setstate__(self, dict_returned_by_pickle):
self.__dict__.update(dict_returned_by_pickle)
當醃製狀態是一本字典。這是我在answer here on stackoverflow中看到的。 但是,這是一個安全
我使用泡沫https://fedorahosted.org/suds/來使用SOAP獲取數據。我想緩存結果(使用memcached)不要從我要提取數據的地方重載服務器。問題是在獲取緩存的數據時。獲取它工作正常,但隨後的Django試圖將數據(force_unicode)解碼和它失敗,出現以下: The string that could not be encoded/decoded was: ar