Opened 15 years ago

Closed 15 years ago

#4 closed defect (fixed)

can not attach files to tickets

Reported by: erikos Owned by: bernie
Priority: blocker Milestone:
Component: infrastructure Version:
Severity: Keywords:
Cc: Distribution/OS:
Bug Status:


Trac detected an internal error:

OSError: [Errno 13] Permission denied: '/var/www-sugarlabs/dev/attachments/ticket'

If you think this should work you can reproduce the problem, you should consider reporting this to the Trac team.

Before you do that, though, please first try searching for similar issues, as it is quite likely that this problem has been reported before. For questions about installation and configuration of Trac, please try the mailing list instead of filing a ticket.

Otherwise, please ==== How to Reproduce ==== While doing a POST operation on /attachment/ticket/2/, Trac issued an internal error. (please provide additional details here) Request parameters: {'__FORM_TOKEN': u'a510ed8e44467f39aae61a56', 'action': u'new', 'attachment': FieldStorage('attachment', 'nm07_wpa.patch', 'diff --git a/src/jarabe/desktop/ b/src/jarabe/desktop/\nindex ed50d55..975abeb 100644\n--- a/src/jarabe/desktop/\n+++ b/src/jarabe/desktop/\n@@ -22,34 +22,8 @@ import dbus\n \n from jarabe.model import network\n \n-IW_AUTH_ALG_OPEN_SYSTEM = 0x00000001\n-IW_AUTH_ALG_SHARED_KEY = 0x00000002\n-\n-IW_AUTH_WPA_VERSION_DISABLED = 0x00000001\n-IW_AUTH_WPA_VERSION_WPA = 0x00000002\n-IW_AUTH_WPA_VERSION_WPA2 = 0x00000004\n-\n-NM_802_11_CAP_NONE = 0x00000000\n-NM_802_11_CAP_PROTO_NONE = 0x00000001\n-NM_802_11_CAP_PROTO_WEP = 0x00000002\n-NM_802_11_CAP_PROTO_WPA = 0x00000004\n-NM_802_11_CAP_PROTO_WPA2 = 0x00000008\n-NM_802_11_CAP_KEY_MGMT_PSK = 0x00000040\n-NM_802_11_CAP_KEY_MGMT_802_1X = 0x00000080\n-NM_802_11_CAP_CIPHER_WEP40 = 0x00001000\n-NM_802_11_CAP_CIPHER_WEP104 = 0x00002000\n-NM_802_11_CAP_CIPHER_TKIP = 0x00004000\n-NM_802_11_CAP_CIPHER_CCMP = 0x00008000\n-\n-NM_AUTH_TYPE_WPA_PSK_AUTO = 0x00000000\n-IW_AUTH_CIPHER_NONE = 0x00000001\n-IW_AUTH_CIPHER_WEP40 = 0x00000002\n-IW_AUTH_CIPHER_TKIP = 0x00000004\n-IW_AUTH_CIPHER_CCMP = 0x00000008\n-IW_AUTH_CIPHER_WEP104 = 0x00000010\n-\n-IW_AUTH_KEY_MGMT_802_1X = 0x1\n-IW_AUTH_KEY_MGMT_PSK = 0x2\n+IW_AUTH_ALG_OPEN_SYSTEM = \'open\'\n+IW_AUTH_ALG_SHARED_KEY = \'shared\'\n \n def string_is_hex(key):\n is_hex = True\n@@ -109,7 +83,6 @@ class KeyDialog(gtk.Dialog):\n \n def add_key_entry(self):\n self._entry = gtk.Entry()\n- #self._entry.props.visibility = False\n self._entry.connect(\'changed\', self._update_response_sensitivity)\n self._entry.connect(\'activate\', self._entry_activate_cb)\n self.vbox.pack_start(self._entry)\n@@ -159,7 +132,7 @@ class WEPKeyDialog(KeyDialog):\n self.add_key_entry()\n \n # WEP authentication mode\n- self.auth_store = gtk.ListStore(str, int)\n+ self.auth_store = gtk.ListStore(str, str)\n self.auth_store.append(["Open System", IW_AUTH_ALG_OPEN_SYSTEM])\n self.auth_store.append(["Shared Key", IW_AUTH_ALG_SHARED_KEY])\n \n@@ -193,23 +166,17 @@ class WEPKeyDialog(KeyDialog):\n it = self.auth_combo.get_active_iter()\n (auth_alg, ) = self.auth_store.get(it, 1)\n \n- we_cipher = None\n- if len(key) == 26:\n- we_cipher = IW_AUTH_CIPHER_WEP104\n- elif len(key) == 10:\n- we_cipher = IW_AUTH_CIPHER_WEP40\n-\n- return (we_cipher, key, auth_alg)\n+ return (key, auth_alg)\n \n def print_security(self):\n- (we_cipher, key, auth_alg) = self._get_security()\n- print "Cipher: %d" % we_cipher\n+ (key, auth_alg) = self._get_security()\n print "Key: %s" % key\n print "Auth: %d" % auth_alg\n \n def create_security(self):\n- (we_cipher, key, auth_alg) = self._get_security()\n- return { "802-11-wireless-security": { "wep-key0": key } }\n+ (key, auth_alg) = self._get_security()\n+ return {"802-11-wireless-security": {"wep-key0": key, \n+ "auth-alg": auth_alg}}\n \n def _update_response_sensitivity(self, ignored=None):\n key = self._entry.get_text()\n@@ -236,12 +203,8 @@ class WPAKeyDialog(KeyDialog):\n KeyDialog.__init__(self, ssid, caps, response)\n self.add_key_entry()\n \n- = gtk.ListStore(str, int)\n-["Automatic", NM_AUTH_TYPE_WPA_PSK_AUTO])\n- if caps & NM_802_11_CAP_CIPHER_CCMP:\n-["AES-CCMP", IW_AUTH_CIPHER_CCMP])\n- if caps & NM_802_11_CAP_CIPHER_TKIP:\n-["TKIP", IW_AUTH_CIPHER_TKIP])\n+ = gtk.ListStore(str)\n+[_("WPA & WPA2 Personal")])\n \n self.combo = gtk.ComboBox(\n cell = gtk.CellRendererText()\n@@ -250,7 +213,7 @@ class WPAKeyDialog(KeyDialog):\n self.combo.set_active(0)\n \n self.hbox = gtk.HBox()\n- self.hbox.pack_start(gtk.Label(_("Encryption Type:")))\n+ self.hbox.pack_start(gtk.Label(_("Wireless Security:")))\n self.hbox.pack_start(self.combo)\n self.hbox.show_all()\n \n@@ -280,23 +243,15 @@ class WPAKeyDialog(KeyDialog):\n if not real_key:\n raise RuntimeError("Invalid key")\n \n- it = self.combo.get_active_iter()\n- (we_cipher, ) =, 1)\n-\n- wpa_ver = IW_AUTH_WPA_VERSION_WPA\n- if self._caps & NM_802_11_CAP_PROTO_WPA2:\n- wpa_ver = IW_AUTH_WPA_VERSION_WPA2\n-\n- return (we_cipher, real_key, wpa_ver)\n+ return real_key\n \n def print_security(self):\n- (we_cipher, key, wpa_ver) = self._get_security()\n- print "Cipher: %d" % we_cipher\n+ key = self._get_security() \n print "Key: %s" % key\n- print "WPA Ver: %d" % wpa_ver\n \n- def create_security(self):\n- pass\n+ def create_security(self): \n+ real_key = self._get_security()\n+ return {"802-11-wireless-security": {"psk": real_key}}\n \n def _update_response_sensitivity(self, ignored=None):\n key = self._entry.get_text()\n@@ -312,13 +267,12 @@ class WPAKeyDialog(KeyDialog):\n self.set_response_sensitive(gtk.RESPONSE_OK, valid)\n return False\n \n-def create(ssid, caps, response):\n- if (caps & NM_802_11_CAP_CIPHER_TKIP or caps & NM_802_11_CAP_CIPHER_CCMP) \\\n- and (caps & NM_802_11_CAP_PROTO_WPA or \\\n- caps & NM_802_11_CAP_PROTO_WPA2):\n- key_dialog = WPAKeyDialog(ssid, caps, response)\n+def create(ssid, wpa_caps, rsn_caps, response):\n+ if wpa_caps == network.NM_802_11_AP_SEC_NONE and \\\n+ rsn_caps == network.NM_802_11_AP_SEC_NONE:\n+ key_dialog = WEPKeyDialog(ssid, None, response)\n else:\n- key_dialog = WEPKeyDialog(ssid, caps, response)\n+ key_dialog = WPAKeyDialog(ssid, wpa_caps, response)\n \n key_dialog.connect("response", _key_dialog_response_cb)\n key_dialog.connect("destroy", _key_dialog_destroy_cb)\ndiff --git a/src/jarabe/desktop/ b/src/jarabe/desktop/\nindex eaf2792..813153c 100644\n--- a/src/jarabe/desktop/\n+++ b/src/jarabe/desktop/\n@@ -68,7 +68,11 @@ class AccessPointView(CanvasPulsingIcon):\n self._strength = 0\n self._flags = 0\n self._wpa_flags = 0\n+ self._rsn_flags = 0\n+ self._mode = 0\n+ self._device_caps = 0\n self._device_state = None\n+ self._conn = None\n self._active = True\n \n self.connect(\'activated\', self._activate_cb)\n@@ -93,6 +97,9 @@ class AccessPointView(CanvasPulsingIcon):\n self._device.Get(_NM_DEVICE_IFACE, \'State\',\n reply_handler=self.__get_device_state_reply_cb,\n error_handler=self.__get_device_state_error_cb)\n+ self._device.Get(_NM_WIRELESS_IFACE, \'WirelessCapabilities\',\n+ reply_handler=self.__get_device_caps_reply_cb,\n+ error_handler=self.__get_device_caps_error_cb)\n self._device.Get(_NM_WIRELESS_IFACE, \'ActiveAccessPoint\',\n reply_handler=self.__get_active_ap_reply_cb,\n error_handler=self.__get_active_ap_error_cb)\n@@ -140,16 +147,19 @@ class AccessPointView(CanvasPulsingIcon):\n self._active = (ap == self._model.object_path)\n self._update_state()\n \n- def _update_properties(self, props):\n- if \'Ssid\' in props:\n- self._name = props[\'Ssid\']\n- if \'Strength\' in props:\n- self._strength = props[\'Strength\']\n- if \'Flags\' in props:\n- self._flags = props[\'Flags\']\n- if \'WpaFlags\' in props:\n- self._wpa_flags = props[\'WpaFlags\']\n-\n+ def _update_properties(self, properties):\n+ if \'Ssid\' in properties:\n+ self._name = properties[\'Ssid\']\n+ if \'Strength\' in properties:\n+ self._strength = properties[\'Strength\']\n+ if \'Flags\' in properties:\n+ self._flags = properties[\'Flags\']\n+ if \'WpaFlags\' in properties:\n+ self._wpa_flags = properties[\'WpaFlags\']\n+ if \'RsnFlags\' in properties:\n+ self._rsn_flags = properties[\'RsnFlags\']\n+ if \'Mode\' in properties:\n+ self._mode = properties[\'Mode\'] \n self._update()\n \n def _compute_color(self):\n@@ -169,6 +179,12 @@ class AccessPointView(CanvasPulsingIcon):\n def __get_active_ap_error_cb(self, err):\n logging.debug(\'Error getting the active access point: %s\', err)\n \n+ def __get_device_caps_reply_cb(self, caps):\n+ self._device_caps = caps\n+\n+ def __get_device_caps_error_cb(self, err):\n+ logging.debug(\'Error getting the wireless device properties: %s\', err)\n+\n def __get_device_state_reply_cb(self, state):\n self._device_state = state\n self._update()\n@@ -183,7 +199,7 @@ class AccessPointView(CanvasPulsingIcon):\n logging.debug(\'Error getting the access point properties: %s\', err)\n \n def _update(self):\n- if self._flags == network.AP_FLAGS_802_11_PRIVACY:\n+ if self._flags == network.NM_802_11_AP_FLAGS_PRIVACY:\n self.props.badge_name = "emblem-locked"\n else:\n self.props.badge_name = None\n@@ -240,6 +256,59 @@ class AccessPointView(CanvasPulsingIcon):\n def _disconnect_activate_cb(self, item):\n pass\n \n+ def _add_ciphers_from_flags(self, flags, pairwise):\n+ ciphers = []\n+ if pairwise:\n+ if flags & network.NM_802_11_AP_SEC_PAIR_TKIP:\n+ ciphers.append("tkip")\n+ if flags & network.NM_802_11_AP_SEC_PAIR_CCMP:\n+ ciphers.append("ccmp")\n+ else:\n+ if flags & network.NM_802_11_AP_SEC_GROUP_WEP40:\n+ ciphers.append("wep40")\n+ if flags & network.NM_802_11_AP_SEC_GROUP_WEP104:\n+ ciphers.append("wep104")\n+ if flags & network.NM_802_11_AP_SEC_GROUP_TKIP:\n+ ciphers.append("tkip")\n+ if flags & network.NM_802_11_AP_SEC_GROUP_CCMP:\n+ ciphers.append("ccmp")\n+ return ciphers\n+\n+ def _get_security(self):\n+ if not (self._flags & network.NM_802_11_AP_FLAGS_PRIVACY) and \\\n+ (self._wpa_flags == network.NM_802_11_AP_SEC_NONE) and \\\n+ (self._rsn_flags == network.NM_802_11_AP_SEC_NONE):\n+ # No security\n+ return\n+\n+ if (self._flags & network.NM_802_11_AP_FLAGS_PRIVACY) and \\\n+ (self._wpa_flags == network.NM_802_11_AP_SEC_NONE) and \\\n+ (self._rsn_flags == network.NM_802_11_AP_SEC_NONE):\n+ # Static WEP, Dynamic WEP, or LEAP\n+ return {"key-mgmt": "none"}\n+ \n+ if (self._mode != network.NM_802_11_MODE_INFRA):\n+ # Stuff after this point requires infrastructure \n+ logging.error(\'The infrastructure mode is not supoorted\' \n+ \' by your wireless device.\')\n+ return \n+ \n+ if (self._rsn_flags & network.NM_802_11_AP_SEC_KEY_MGMT_PSK) and \\\n+ (self._device_caps & network.NM_802_11_DEVICE_CAP_RSN):\n+ # WPA2 PSK first \n+ pairwise = self._add_ciphers_from_flags(self._rsn_flags, True)\n+ group = self._add_ciphers_from_flags(self._rsn_flags, False)\n+ return {"key-mgmt": "wpa-psk", "proto": "rsn", \n+ "pairwise": pairwise, "group": group}\n+ \n+ if (self._wpa_flags & network.NM_802_11_AP_SEC_KEY_MGMT_PSK) and \\\n+ (self._device_caps & network.NM_802_11_DEVICE_CAP_WPA):\n+ # WPA PSK \n+ pairwise = self._add_ciphers_from_flags(self._wpa_flags, True)\n+ group = self._add_ciphers_from_flags(self._wpa_flags, False)\n+ return {"key-mgmt": "wpa-psk", "proto": "wpa", \n+ "pairwise": pairwise, "group": group}\n+\n def _activate_cb(self, icon):\n conn = network.find_connection(self._name)\n if conn is None:\n@@ -248,14 +317,16 @@ class AccessPointView(CanvasPulsingIcon):\n \'type\' : \'802-11-wireless\' } ,\n \'802-11-wireless\' : { \'ssid\': self._name }\n }\n-\n- if self._flags == network.AP_FLAGS_802_11_PRIVACY:\n- info["802-11-wireless-security"] = { "key-mgmt": "none" }\n-\n+ security = self._get_security()\n+ if security:\n+ info[\'802-11-wireless-security\'] = security\n conn = network.add_connection(self._name, info)\n+ if not security:\n+ self._conn = conn\n \n obj = self._bus.get_object(_NM_SERVICE, _NM_PATH)\n netmgr = dbus.Interface(obj, _NM_IFACE)\n+ \n netmgr.ActivateConnection(network.SETTINGS_SERVICE, conn.path,\n self._device.object_path,\n self._model.object_path,\n@@ -263,6 +334,8 @@ class AccessPointView(CanvasPulsingIcon):\n error_handler=self.__activate_error_cb)\n \n def __activate_reply_cb(self, connection):\n+ if self._conn:\n+\n logging.debug(\'Connection activated: %s\', connection)\n \n def __activate_error_cb(self, err):\n@@ -273,7 +346,7 @@ class AccessPointView(CanvasPulsingIcon):\n self._update_state()\n \n def create_keydialog(self, response):\n- keydialog.create(self._name, self._wpa_flags, response)\n+ keydialog.create(self._name, self._wpa_flags, self._rsn_flags, response)\n \n def disconnect(self):\n self._bus.remove_signal_receiver(self.__ap_properties_changed_cb,\n@@ -662,12 +735,6 @@ class MeshBox(gtk.VBox):\n def _activity_removed_cb(self, model, activity_model):\n self._remove_activity(activity_model) \n \n- def _access_point_added_cb(self, model, ap_model):\n- self._add_access_point(ap_model)\n-\n- def _access_point_removed_cb(self, model, ap_model):\n- self._remove_access_point(ap_model) \n-\n def _add_alone_buddy(self, buddy_model):\n icon = BuddyIcon(buddy_model)\n if buddy_model.is_owner():\ndiff --git a/src/jarabe/model/ b/src/jarabe/model/\nindex d311174..f8fd4cc 100644\n--- a/src/jarabe/model/\n+++ b/src/jarabe/model/\n@@ -15,10 +15,13 @@\n # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\n \n import logging\n+import os\n \n import dbus\n+import ConfigParser\n \n from sugar import dispatch\n+from sugar import env\n \n DEVICE_TYPE_802_11_WIRELESS = 2\n \n@@ -33,8 +36,32 @@ DEVICE_STATE_IP_CONFIG = 7\n DEVICE_STATE_ACTIVATED = 8\n DEVICE_STATE_FAILED = 9\n \n-AP_FLAGS_802_11_NONE = 0\n-AP_FLAGS_802_11_PRIVACY = 1\n+NM_802_11_AP_FLAGS_NONE = 0x00000000\n+NM_802_11_AP_FLAGS_PRIVACY = 0x00000001\n+\n+NM_802_11_AP_SEC_NONE = 0x00000000\n+NM_802_11_AP_SEC_PAIR_WEP40 = 0x00000001\n+NM_802_11_AP_SEC_PAIR_WEP104 = 0x00000002\n+NM_802_11_AP_SEC_PAIR_TKIP = 0x00000004\n+NM_802_11_AP_SEC_PAIR_CCMP = 0x00000008\n+NM_802_11_AP_SEC_GROUP_WEP40 = 0x00000010\n+NM_802_11_AP_SEC_GROUP_WEP104 = 0x00000020\n+NM_802_11_AP_SEC_GROUP_TKIP = 0x00000040\n+NM_802_11_AP_SEC_GROUP_CCMP = 0x00000080\n+NM_802_11_AP_SEC_KEY_MGMT_PSK = 0x00000100\n+NM_802_11_AP_SEC_KEY_MGMT_802_1X = 0x00000200\n+\n+NM_802_11_MODE_UNKNOWN = 0\n+NM_802_11_MODE_ADHOC = 1\n+NM_802_11_MODE_INFRA = 2\n+\n+NM_802_11_DEVICE_CAP_NONE = 0x00000000\n+NM_802_11_DEVICE_CAP_CIPHER_WEP40 = 0x00000001\n+NM_802_11_DEVICE_CAP_CIPHER_WEP104 = 0x00000002\n+NM_802_11_DEVICE_CAP_CIPHER_TKIP = 0x00000004\n+NM_802_11_DEVICE_CAP_CIPHER_CCMP = 0x00000008\n+NM_802_11_DEVICE_CAP_WPA = 0x00000010\n+NM_802_11_DEVICE_CAP_RSN = 0x00000020\n \n SETTINGS_SERVICE = \'org.freedesktop.NetworkManagerUserSettings\'\n \n@@ -46,6 +73,44 @@ NM_SECRETS_IFACE = \'org.freedesktop.NetworkManagerSettings.Connection.Secrets\'\n _nm_settings = None\n _conn_counter = 0\n \n+class NMConfig(ConfigParser.ConfigParser):\n+ def get_bool(self, section, name):\n+ opt = self.get(section, name)\n+ if type(opt) == str:\n+ if opt.lower() == \'yes\' or opt.lower() == \'true\':\n+ return True\n+ elif opt.lower() == \'no\' or opt.lower() == \'false\':\n+ return False\n+ raise ValueError("Invalid format for %s/%s. Should be one of" \\\n+ " [yes, no, true, false]." % (section, name))\n+\n+ def get_list(self, section, name):\n+ opt = self.get(section, name)\n+ if type(opt) != str or not len(opt):\n+ return []\n+ try:\n+ return opt.split()\n+ except Exception:\n+ raise ValueError("Invalid format for %s/%s. Should be a" \\\n+ " space-separate list." % (section, name))\n+\n+ def get_int(self, section, name):\n+ opt = self.get(section, name)\n+ try:\n+ return int(opt)\n+ except ValueError:\n+ raise ValueError("Invalid format for %s/%s. Should be a" \\\n+ " valid integer." % (section, name))\n+\n+ def get_float(self, section, name):\n+ opt = self.get(section, name)\n+ try:\n+ return float(opt)\n+ except ValueError:\n+ raise ValueError("Invalid format for %s/%s. Should be a" \\\n+ " valid float." % (section, name))\n+\n+\n class NMSettings(dbus.service.Object):\n def __init__(self):\n bus = dbus.SystemBus()\n@@ -103,6 +168,63 @@ class NMSettingsConnection(dbus.service.Object):\n \n def set_secrets(self, secrets):\n self._secrets = secrets\n+\n+\n+ def save(self):\n+ profile_path = env.get_profile_path()\n+ config_path = os.path.join(profile_path, "nm", "networks.cfg")\n+\n+ config = NMConfig()\n+ try:\n+ if not\n+ logging.error(\'Error reading the nm config file\')\n+ return\n+ identifier = self._settings[\'connection\'][\'id\']\n+\n+ if identifier not in config.sections():\n+ config.add_section(identifier)\n+ config.set(identifier, \'type\', \n+ self._settings[\'connection\'][\'type\'])\n+ config.set(identifier, \'ssid\', \n+ self._settings[\'802-11-wireless\'][\'ssid\'])\n+ config.set(identifier, \'uuid\', \n+ self._settings[\'connection\'][\'uuid\'])\n+ if self._settings.has_key(\'802-11-wireless-security\'):\n+ key = \'key-mgmt\'\n+ if self._settings[\'802-11-wireless-security\'].has_key(key):\n+ value = self._settings[\'802-11-wireless-security\'][key]\n+ config.set(identifier, key, value)\n+ key = \'proto\'\n+ if self._settings[\'802-11-wireless-security\'].has_key(key):\n+ value = self._settings[\'802-11-wireless-security\'][key]\n+ config.set(identifier, key, value)\n+ key = \'pairwise\'\n+ if self._settings[\'802-11-wireless-security\'].has_key(key):\n+ value = self._settings[\'802-11-wireless-security\'][key]\n+ config.set(identifier, key, value)\n+ key = \'group\'\n+ if self._settings[\'802-11-wireless-security\'].has_key(key):\n+ value = self._settings[\'802-11-wireless-security\'][key]\n+ config.set(identifier, key, value)\n+\n+ mgmt = self._settings[\'802-11-wireless-security\'][\'key-mgmt\']\n+ if self._secrets is not None and mgmt == \'none\':\n+ key = self._secrets[\'802-11-wireless-security\'][\'wep-key0\']\n+ config.set(identifier, \'key\', key)\n+ key = self._secrets[\'802-11-wireless-security\'][\'auth-alg\']\n+ config.set(identifier, \'auth-alg\', key)\n+ elif self._secrets is not None and mgmt == \'wpa-psk\':\n+ key = self._secrets[\'802-11-wireless-security\'][\'psk\']\n+ config.set(identifier, \'key\', key)\n+ except ConfigParser.Error, e:\n+ logging.error("Error writing %s: %s" % (identifier, e))\n+ else:\n+ f = open(config_path, \'w\')\n+ try:\n+ config.write(f)\n+ except ConfigParser.Error, e:\n+ logging.error(\'Can not write %s error: %s\' % (config_path, e))\n+ f.close()\n \n @dbus.service.method(dbus_interface=NM_CONNECTION_IFACE,\n in_signature=\'\', out_signature=\'a{sa{sv}}\')\n@@ -133,6 +255,7 @@ def get_settings():\n _nm_settings = NMSettings()\n except dbus.DBusException, e:\n logging.error(\'Cannot create the UserSettings service %s.\', e)\n+ load_connections()\n return _nm_settings\n \n def find_connection(ssid):\n@@ -150,8 +273,52 @@ def add_connection(ssid, settings, secrets=None):\n \n conn = NMSettingsConnection(path, settings, secrets)\n _nm_settings.add_connection(ssid, conn)\n-\n return conn\n \n def load_connections():\n- pass\n+ profile_path = env.get_profile_path()\n+ config_path = os.path.join(profile_path, "nm", "networks.cfg")\n+\n+ config = NMConfig()\n+\n+ if not os.path.exists(config_path):\n+ if not os.path.exists(os.path.dirname(config_path)):\n+ os.makedirs(os.path.dirname(config_path), 0755)\n+ f = open(config_path, \'w\')\n+ config.write(f)\n+ f.close()\n+\n+ if not\n+ logging.error(\'Error reading the nm config file\')\n+ return\n+ \n+ for section in config.sections():\n+ secrets = None\n+ settings = {\'connection\': {\'id\': section}} \n+ ssid = config.get(section, \'ssid\')\n+ settings[\'802-11-wireless\'] = {\'ssid\': dbus.ByteArray(ssid)}\n+ uuid = config.get(section, \'uuid\')\n+ settings[\'connection\'][\'uuid\'] = uuid\n+ nmtype = config.get(section, \'type\')\n+ settings[\'connection\'][\'type\'] = nmtype\n+ if config.has_option(section, \'key-mgmt\'):\n+ mgmt = config.get(section, \'key-mgmt\')\n+ settings[\'802-11-wireless-security\'] = {\'key-mgmt\': mgmt}\n+ key = config.get(section, \'key\')\n+ if mgmt == \'none\':\n+ auth_alg = config.get(section, \'auth-alg\')\n+ secrets = {\'802-11-wireless-security\': {\'wep-key0\': key, \n+ \'auth-alg\': auth_alg}}\n+ elif mgmt == \'wpa-psk\':\n+ secrets = {\'802-11-wireless-security\': {\'psk\': key}}\n+ if config.has_option(section, \'proto\'):\n+ proto = config.get(section, \'proto\')\n+ settings[\'802-11-wireless-security\'][\'proto\'] = proto\n+ if config.has_option(section, \'pairwise\'):\n+ pairwise = config.get(section, \'pairwise\')\n+ settings[\'802-11-wireless-security\'][\'pairwise\'] = pairwise\n+ if config.has_option(section, \'group\'):\n+ group = config.get(section, \'group\')\n+ settings[\'802-11-wireless-security\'][\'group\'] = group\n+\n+ add_connection(ssid, settings, secrets)\n'), 'description': u'', 'id': u'2', 'path': u'2/', 'realm': u'ticket'} User Agent was: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/2008092318 Fedora/3.0.2-1.fc9 Firefox/3.0.2 ==== System Information ====
Trac 0.11.1 Python 2.5.2 (r252:60911, Jul 31 2008, 18:03:07)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)]
setuptools 0.6c8 SQLite 3.4.2 pysqlite 2.3.2 Genshi 0.5.1 jQuery: 1.2.6 ==== Python Traceback ==== Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/web/", line 423, in _dispatch_request dispatcher.dispatch(req) File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/web/", line 197, in dispatch resp = chosen_handler.process_request(req) File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/", line 394, in process_request self._do_save(req, attachment) File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/", line 606, in _do_save attachment.insert(filename, upload.file, size) File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/", line 218, in insert os.makedirs(self.path) File "/usr/lib/python2.5/", line 164, in makedirs makedirs(head, mode) File "/usr/lib/python2.5/", line 171, in makedirs mkdir(name, mode) OSError: [Errno 13] Permission denied: '/var/www-sugarlabs/dev/attachments/ticket' a new ticket at the Trac project site, where you can describe the problem and explain how to reproduce it.

Python Traceback
Most recent call last:

  • File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/web/", line 423, in _dispatch_request Code fragment:
    1. try:
    2. if not env and env_error:
    3. raise HTTPInternalError(env_error)
    4. try:
    5. dispatcher = RequestDispatcher(env)
    6. dispatcher.dispatch(req)
    7. except RequestDone:
    8. pass
    9. resp = req._response or []
    10. except HTTPException, e:
    Local variables: Name Value after [u' except RequestDone:', u' pass', u' resp = ... before [u' try:', u' if not env and env_error:', u' raise ... dispatcher <trac.web.main.RequestDispatcher object at 0xb66170> e OSError(13, 'Permission denied') env <trac.env.Environment object at 0x94d070> env_error None exc_info (<type 'exceptions.OSError'>, OSError(13, 'Permission denied'), <traceback ... filename '/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/web/' frames [{'function': '_dispatch_request', 'lines_before': [u' try:', u' ... has_admin True line u' dispatcher.dispatch(req)' lineno 422 message u"OSError: [Errno 13] Permission denied: ... req <Request "POST u'/attachment/ticket/2/'"> resp [] tb <traceback object at 0xbe0b70> tb_hide None traceback 'Traceback (most recent call last):\n File ...
  • File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/web/", line 197, in dispatch Code fragment:
    1. req.args.get('FORM_TOKEN') != req.form_token:
    2. raise HTTPBadRequest('Missing or invalid form token. '
    3. 'Do you have cookies enabled?')
    4. # Process the request and render the template
    5. resp = chosen_handler.process_request(req)
    6. if resp:
    7. if len(resp) == 2: # Clearsilver
    8. chrome.populate_hdf(req)
    9. template, content_type = \
    10. self._post_process_request(req, *resp)
    Local variables: Name Value chosen_handler <trac.attachment.AttachmentModule object at 0xa80a90> chrome < object at 0xa80970> ctype 'multipart/form-data' err (<type 'exceptions.OSError'>, OSError(13, 'Permission denied'), <traceback ... handler <trac.attachment.AttachmentModule object at 0xa80a90> options {'boundary': '---------------------------19999383091868633031017948804'} req <Request "POST u'/attachment/ticket/2/'"> self <trac.web.main.RequestDispatcher object at 0xb66170>
  • File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/", line 394, in process_request Code fragment:
    1. attachment = Attachment(self.env, parent.child('attachment', filename)) 391.
    2. if req.method == 'POST':
    3. if action == 'new':
    4. self._do_save(req, attachment)
    5. elif action == 'delete':
    6. self._do_delete(req, attachment)
    7. elif action == 'delete':
    8. data = self._render_confirm_delete(req, attachment)
    9. elif action == 'new':
    Local variables: Name Value action u'new' attachment <trac.attachment.Attachment object at 0xc0a4b0> filename None parent <Resource u'ticket:2'> parent_id u'2' parent_name u'Ticket #2' parent_realm <Resource u'ticket'> parent_url '/ticket/2' path u'2/' req <Request "POST u'/attachment/ticket/2/'"> self <trac.attachment.AttachmentModule object at 0xa80a90>
  • File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/", line 606, in _do_save Code fragment:
    1. req.perm(attachment.resource).require('ATTACHMENT_DELETE')
    2. old_attachment.delete()
    3. except TracError:
    4. pass # don't worry if there's nothing to replace
    5. attachment.filename = None
    6. attachment.insert(filename, upload.file, size)
    7. req.redirect(get_resource_url(self.env, attachment.resource(id=None),
    8. req.href))
    9. def _do_delete(self, req, attachment):
    Local variables: Name Value attachment <trac.attachment.Attachment object at 0xc0a4b0> filename u'nm07_wpa.patch' max_size 262144 req <Request "POST u'/attachment/ticket/2/'"> self <trac.attachment.AttachmentModule object at 0xa80a90> size 23241L upload FieldStorage('attachment', 'nm07_wpa.patch', 'diff --git ...
  • File "/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/", line 218, in insert Code fragment:
    1. 'attachments')
    2. commonprefix = os.path.commonprefix([attachments_dir, self.path])
    3. assert commonprefix == attachments_dir
    4. if not os.access(self.path, os.F_OK):
    5. os.makedirs(self.path)
    6. filename = unicode_quote(filename)
    7. path, targetfile = create_unique_file(os.path.join(self.path,
    8. filename))
    9. try:
    10. # Note: path is an unicode string because self.path was one.
    Local variables: Name Value attachments_dir '/var/www-sugarlabs/dev/attachments' commonprefix '/var/www-sugarlabs/dev/attachments' db <trac.db.pool.PooledConnection object at 0xc2d7d8> filename u'nm07_wpa.patch' fileobj <open file '<fdopen>', mode 'w+b' at 0xb4f338> handle_ta True self <trac.attachment.Attachment object at 0xc0a4b0> size 23241L t None timestamp 1226311391
  • File "/usr/lib/python2.5/", line 164, in makedirs Code fragment:
    1. head, tail = path.split(name)
    2. if not tail:
    3. head, tail = path.split(head)
    4. if head and tail and not path.exists(head):
    5. try:
    6. makedirs(head, mode)
    7. except OSError, e:
    8. # be happy if someone already created the path
    9. if e.errno != errno.EEXIST:
    10. raise
    11. if tail == curdir: # xxx/newdir/. exists if xxx/newdir exists
    Local variables: Name Value e OSError(13, 'Permission denied') head u'/var/www-sugarlabs/dev/attachments/ticket' mode 511 name u'/var/www-sugarlabs/dev/attachments/ticket/2' tail u'2'
  • File "/usr/lib/python2.5/", line 171, in makedirs

Attachments (1)

sugarlabs_wiki_logo.png (5.2 KB) - added by bernie 15 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 15 years ago by erikos

  • Priority changed from critical to blocker

Changed 15 years ago by bernie


comment:2 Changed 15 years ago by bernie

Appears to be fixed.

Bud did any of you receive the notification email? I didn't.

comment:3 Changed 15 years ago by erikos

works for me now as well

comment:4 Changed 15 years ago by erikos

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.