Esempio n. 1
0
    def check_nano_input(self):
        """This is not called anywhere by default. The intention is that is
        this is called after nano has been closed in check_command.
        """

        end_path = generate_real_path(self.get_goal_nano_filepath())

        if os.path.exists(end_path):
            f = open(end_path, "r")
            text = f.read()
            f.close()

            if text.strip() == self.get_goal_nano_end_content():
                return True
            else:
                self.send_hint(
                    _("\n{{rb:Your text is not correct! Type}} {{yb:nano %s}} {{rb:to try again.}}")
                    % self.get_goal_nano_save_name()
                )
                return False
        else:
            self.send_hint(
                _("\n{{rb:The file path}} {{lb:%s}} {{rb:does not exist - did you save your file correctly?}}")
                % end_path)
            return False
Esempio n. 2
0
    def read_goal_contents(self):
        text = ""
        end_path = generate_real_path(self._step_nano.get_goal_nano_filepath())

        if os.path.exists(end_path):
            # check contents of file contains the self.end_text
            f = open(end_path, "r")
            text = f.read()
            f.close()

        return text
Esempio n. 3
0
    def check_nano_input(self):
        """This is not called anywhere by default. The intention is that is
        this is called after nano has been closed in check_command.
        """

        end_path = generate_real_path(self.get_goal_nano_filepath())

        if os.path.exists(end_path):
            f = open(end_path, "r")
            text = f.read()
            f.close()

            if text.strip() == self.get_goal_nano_end_content():
                return True
            else:
                self.send_hint(
                    _("\n{{rb:Your text is not correct! Type}} {{yb:nano %s}} {{rb:to try again.}}"
                      ) % self.get_goal_nano_save_name())
                return False
        else:
            self.send_hint(
                _("\n{{rb:The file path}} {{lb:%s}} {{rb:does not exist - did you save your file correctly?}}"
                  ) % end_path)
            return False
Esempio n. 4
0
 def check_command(self, line):
     dir = generate_real_path("~/woods/thicket/rabbithole")
     if has_write_permissions(dir) and has_read_permissions(
             dir) and has_execute_permissions(dir):
         return True
     self.send_stored_hint()
 def next(self):
     path = generate_real_path("~/woods/clearing/house")
     os.chmod(path, 0755)
     return 38, 4
Esempio n. 6
0
 def check_command(self, line):
     if has_write_permissions(generate_real_path("~/woods/thicket/rabbithole/cage")):
         return True
     self.send_stored_hint()
Esempio n. 7
0
 def check_command(self, line):
     chest = generate_real_path("~/woods/cave/chest")
     if has_write_permissions(chest) and has_read_permissions(
             chest) and has_execute_permissions(chest):
         return True
     self.send_stored_hint()
 def check_command(self, line):
     dir = generate_real_path("~/woods/thicket/rabbithole")
     if has_write_permissions(dir) and has_read_permissions(dir) and has_execute_permissions(dir):
         return True
     self.send_stored_hint()
 def check_command(self, line):
     chest = generate_real_path("~/woods/cave/chest")
     if has_write_permissions(chest) and has_read_permissions(chest) and has_execute_permissions(chest):
         return True
     self.send_stored_hint()