예제 #1
0
 def writeSettings(self, doc):
     if self.syncer is None:
         return
     settings = self.syncer.s._asdict()
     settings["expressions"] = ["{}:::{}".format(k, v) for k, v in settings[
         "expressions"].iteritems()]
     ProjectHandler.writeSettings("SHPSYNC", settings)
예제 #2
0
파일: shpsync.py 프로젝트: signedav/shpsync
 def writeSettings(self, doc):
     if self.syncer is None:
         return
     settings = self.syncer.s._asdict()
     settings["expressions"] = [
         "{}:::{}".format(k, v)
         for k, v in settings["expressions"].iteritems()
     ]
     ProjectHandler.writeSettings("SHPSYNC", settings)
예제 #3
0
 def readSettings(self):
     # "Settings","excelName excelSheetName excelKeyName skipLines shpName shpKeyName expressions")
     self.reset()
     metasettings = OrderedDict()
     metasettings["excelName"] = (str, None)
     metasettings["excelSheetName"] = (str, None)
     metasettings["excelKeyName"] = (str, None)
     metasettings["skipLines"] = (int, None)
     metasettings["shpKeyName"] = (str, None)
     metasettings["shpName"] = (str, None)
     metasettings["expressions"] = (list, [])
     metasettings["hideDialog"] = (bool, False)
     settings_dict = ProjectHandler.readSettings("SHPSYNC", metasettings)
     if "excelName" not in settings_dict or settings_dict["excelName"]=='':
         return
     else:
         exps = settings_dict["expressions"]
         exps_dict = {}
         for exp in exps:
             kv = exp.split(":::")
             exps_dict[kv[0]] = kv[1]
         settings = Settings(settings_dict["excelName"], settings_dict["excelSheetName"], settings_dict["excelKeyName"],
                             settings_dict["skipLines"], settings_dict["shpName"], settings_dict["shpKeyName"],
                             exps_dict, settings_dict['hideDialog'])
         self.initSyncer(settings)
예제 #4
0
파일: shpsync.py 프로젝트: signedav/shpsync
 def readSettings(self):
     # "Settings","excelName excelSheetName excelKeyName skipLines shpName shpKeyName expressions")
     self.reset()
     metasettings = OrderedDict()
     metasettings["excelName"] = (str, None)
     metasettings["excelSheetName"] = (str, None)
     metasettings["excelKeyName"] = (str, None)
     metasettings["skipLines"] = (int, None)
     metasettings["shpKeyName"] = (str, None)
     metasettings["shpName"] = (str, None)
     metasettings["expressions"] = (list, [])
     metasettings["hideDialog"] = (bool, False)
     settings_dict = ProjectHandler.readSettings("SHPSYNC", metasettings)
     if "excelName" not in settings_dict or settings_dict["excelName"] == '':
         return
     else:
         exps = settings_dict["expressions"]
         exps_dict = {}
         for exp in exps:
             kv = exp.split(":::")
             exps_dict[kv[0]] = kv[1]
         settings = Settings(
             settings_dict["excelName"], settings_dict["excelSheetName"],
             settings_dict["excelKeyName"], settings_dict["skipLines"],
             settings_dict["shpName"], settings_dict["shpKeyName"],
             exps_dict, settings_dict['hideDialog'])
         self.initSyncer(settings)
예제 #5
0
  def setUp(self):
    super(AccountHandlerBase, self).setUp()

    # Start by putting a user in the datastore.
    user = Membership(first_name="Testy", last_name="Testerson",
                      email="*****@*****.**", plan=None,
                      status=None, hash="anunlikelyhash")
    user.put()

    self.user_hash = user.hash

    # Add the plans we need.
    Plan.all_plans = []
    Plan.legacy_pairs = set()
    self.test_plan = Plan("test", 0, 100, "A test plan.")

    # Clear fake usernames between tests.
    ProjectHandler.clear_usernames()
예제 #6
0
    def setUp(self):
        super(AccountHandlerBase, self).setUp()

        # Start by putting a user in the datastore.
        user = Membership(first_name="Testy",
                          last_name="Testerson",
                          email="*****@*****.**",
                          plan=None,
                          status=None,
                          hash="anunlikelyhash")
        user.put()

        self.user_hash = user.hash

        # Add the plans we need.
        Plan.all_plans = []
        Plan.legacy_pairs = set()
        self.test_plan = Plan("test", 0, 100, "A test plan.")

        # Clear fake usernames between tests.
        ProjectHandler.clear_usernames()
예제 #7
0
 def readSettings(self):
     # "Settings","excelName excelSheetName excelKeyName skipLines shpName shpKeyName expressions")
     self.reset()
     metasettings = OrderedDict()
     metasettings["excelName"] = str
     metasettings["excelSheetName"] = str
     metasettings["excelKeyName"] = str
     metasettings["skipLines"] = int
     metasettings["shpKeyName"] = str
     metasettings["shpName"] = str
     metasettings["expressions"] = list
     metasettings["hideDialog"] = str
     settings_dict = ProjectHandler.readSettings("SHPSYNC", metasettings)
     if not settings_dict:
         return
     else:
         exps = settings_dict["expressions"]
         exps_dict = {}
         for exp in exps:
             kv = exp.split(":::")
             exps_dict[kv[0]] = kv[1]
         settings = Settings(settings_dict["excelName"], settings_dict["excelSheetName"], settings_dict["excelKeyName"],
                             settings_dict["skipLines"], settings_dict["shpName"], settings_dict["shpKeyName"], exps_dict)
         self.initSyncer(settings)
예제 #8
0
  def test_duplicate_usernames(self):
    ProjectHandler.add_username("testy.testerson")

    # It should use the first part of our email.
    response = self.test_app.get("/account/" + self.user_hash)
    self.assertEqual(200, response.status_int)
    self.assertIn("ttesterson", response.body)

    ProjectHandler.add_username("ttesterson")

    # Now it should add a "1" to the end.
    response = self.test_app.get("/account/" + self.user_hash)
    self.assertEqual(200, response.status_int)
    self.assertIn("ttesterson1", response.body)

    ProjectHandler.add_username("ttesterson1")

    # And we can just keep on counting...
    response = self.test_app.get("/account/" + self.user_hash)
    self.assertEqual(200, response.status_int)
    self.assertIn("ttesterson2", response.body)
예제 #9
0
    def test_duplicate_usernames(self):
        ProjectHandler.add_username("testy.testerson")

        # It should use the first part of our email.
        response = self.test_app.get("/account/" + self.user_hash)
        self.assertEqual(200, response.status_int)
        self.assertIn("ttesterson", response.body)

        ProjectHandler.add_username("ttesterson")

        # Now it should add a "1" to the end.
        response = self.test_app.get("/account/" + self.user_hash)
        self.assertEqual(200, response.status_int)
        self.assertIn("ttesterson1", response.body)

        ProjectHandler.add_username("ttesterson1")

        # And we can just keep on counting...
        response = self.test_app.get("/account/" + self.user_hash)
        self.assertEqual(200, response.status_int)
        self.assertIn("ttesterson2", response.body)