Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: storeToJsonFile and restoreFromJsonFile missing in JSONAble #22

Closed
WolfgangFahl opened this issue Apr 12, 2021 · 0 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@WolfgangFahl
Copy link
Owner

WolfgangFahl commented Apr 12, 2021

restore functionality of 0.0.26 release

def storeToJsonFile(self,storeFilePrefix,tableName):
        '''
        store me with the given storeFilePrefix
        
        Args:
            storeFilePrefix(string): the prefix for the JSON file name
            tableName(string): the name of the attribute for which to store the type information
        '''
        JSONAble.storeJsonToFile(self.toJSON(), "%s.json" % storeFilePrefix)
        types=Types.forTable(self, tableName)
        JSONAble.storeJsonToFile(types.toJSON(), "%s-types.json" % storeFilePrefix)
       
 def restoreFromJsonFile(self,storeFilePrefix):
        '''
        restore me from the given storeFilePrefix
        
        Args:
            storeFilePrefix(string): the prefix for the JSON file name
        '''
        jsonStr=JSONAble.readJsonFromFile("%s.json" % storeFilePrefix)
        typesJson=JSONAble.readJsonFromFile("%s-types.json" % storeFilePrefix)
        types=Types(type(self).__name__)
        types.fromJson(typesJson)
        self.fromJson(jsonStr, types)

take the Server Example:

class Server(JSONAble):

@WolfgangFahl WolfgangFahl added the bug Something isn't working label Apr 12, 2021
@WolfgangFahl WolfgangFahl self-assigned this Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant